I’m trying to use MongoDB with Symfony2.1 but I’m facing a problem.
I’m following the tutorial from Symfony website called “How to implement a simple Registration Form with MongoDB“.
In this tutorial, it is said that we can add a constraint on email field as a unique field.
After some tests, it doesn’t work. I can add more than once the same email for my User entity.
The annotation @MongoDBUnique(fields=”email”) seems to fail.
I found someone which has the same problem in a Google Group. At this time (posted on january, 6th), no one has answered or no one seems to have any answer unfortunelately.
Thanks for any clue !
Make sure that index really exists in MongoDb. The specified annotation doesn’t create any index automatically.
For more information check this.