-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
unique_with not enforced #205
Comments
The same problem... |
Please log this in flask-mongoengine - seems like a setup bug. Are the indexes created correctly in mongodb? Does it actually save On Mon, Jan 7, 2013 at 5:29 PM, Equand notifications@github.com wrote:
|
I don't have flask-mongoengine though. |
somehow changing the date field to complexdatetimefield made it work... |
Hmm troubling - Equand can you provide more information or a test case? Also, is your plugin published? Available via pypi? I should make sure I Thanks, Ross On Tue, Jan 8, 2013 at 12:32 AM, Equand notifications@github.com wrote:
|
The core issue was with DateTimeField and datetime.datetime.now() realization and differences from python and javascript... regarding plugin |
I have the exact same problem as @jason-w. Not DateTimeField in my setup. The duplicate documents are actually created in MongoDB. |
Hmm this is confusing then - is there an unique index in mongodb? |
@erdenezul Issue is quite old and it looks like it was due to some confusion between python/js rather than a bug in mongoengine. I had a look at unique_with and it looks fine, index gets created properly in mongodb. Maybe we should close this issue. |
I'm able to create multiple documents with the same values in the fields I've defined using unique_with. I'm using mongoengine in conjunction with flask-mongoengine in my flask app.
Here's my document definition:
Using the above document definition, I'm able to create multiple Items using the same owner_id and owner_item_id combination. The only time the NotUniqueError exception is thrown is the first time time I insert a duplicate document after I restart my local flask app. Every time after that, I can create as many duplicate documents as I wish.
Versions:
flask-mongoengine==0.6
mongoengine==0.7.8
UPDATE: This happens after I deleted the Item collection and on subsequent creates.
The text was updated successfully, but these errors were encountered: