Unique indexes not working #56

diogobaeder opened this Issue Sep 19, 2010 · 9 comments

7 participants


Hi, I'm trying to use model indexes with unique properties, but it's not working as expected by the native ensureIndex method from MongoDB. This is a sample of my model code:
indexes: [
[{username: 1}, {unique: true, dropDups: true}]
the instance save calls are generating subsequential records in the base.

nw commented Oct 13, 2010

a byproduct of mongodb-native

indexes: [
[{username: 1}, {unique: true, dropDups: true}]


Sorry, I can't see the difference to my code sample... aren't they the same?


This is still not working for me, using both unique: true and dropDups: true, it still saves a duplicate value!


Oops, my fault. Restarting mongo fixes it.


I am having the same issue, but I can't find out how to restart mongo on OSX. When I kill the process, it will just spawn again automatically and the unique index is still not working


@ragulka can you open a new issue? please append which version of mongoose and your schema.


@aheckmann Hey, it's weird but after about the 10th time I stopped Mongo, it finally worked. So I'm not gonna open a new ticket yet :)


I am having this issue now.


@alexbooker please provide more information and open up a new issue

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment