Closed ignishub closed 6 years ago
Hi @ignishub. Just to confirm: You have created unique
index on the field url
?
Yes
Hi, could you please provide more data? Can you reproduce the same condition in the mongo shell? Could you please paste the index definition?
mgo behaviour can be mapped to the mongo shell commands, so I would suggest that you try to reproduce your problem in the mongo shell to verify it is a bug in mgo.
I had a quick glance at the update documentation and found this: https://docs.mongodb.com/manual/reference/method/db.collection.update/#use-unique-indexes
Maybe using upsert will solve your issue.
If you have the _id field available, you could use it as the query parameter. Also are you sure the _id field is not modified after retrieval?
Sorry for being inactive. I will try that when i'll be near to my pc. Thank you!
Hi @ignishub
I'm going to close this, but feel free to reply.
Dom
Sorry for being so long. I solved this problem. This was a bug in my code. Sorry =(
Sorry for probably stupid question but:
I have struct like:
I inserted this struct in DB. In Mongo i have index that prevent from duplicationg URL I am trying to update Page
BUT. When i trying to change url in Mongo i still have OLD page AND new page with updated data.
Is that normal?