Open GoogleCodeExporter opened 9 years ago
The save operation also works for updating objects. It looks like you updated
an embedded object with an id which already exists in the database. You cannot
have two objects which have an embedded object with the same id.
Original comment by seb.schr...@gmail.com
on 3 Jul 2012 at 9:53
This document don't have embedded objects:
{
"_id" : ObjectId("4fc6c16a9c425bc0d944a609"),
"messageId" : "325401176381594ea655d483c905aaf789b38b167",
"watcherId" : NumberLong(325401176),
"brochureId" : NumberLong(327736393),
"recipientIdentifier" : "e36d546064d3253259cf862a75e0fd6a6150eb81",
"token" : "32540117694e801b27c254b69a3873a6e1f0ae2e2",
"messageType" : "WATCHER_MAIL",
"dateCreated" : ISODate("2012-05-31T00:55:06.702Z"),
"position" : 0,
"viewType" : "IMPLICIT",
"timeZoneId" : "Europe/Berlin",
"dateViewed" : ISODate("2012-06-20T06:32:55.497Z")
}
Original comment by wolw...@gmail.com
on 5 Jul 2012 at 9:05
I found that update works with E11000 error. So two questions are open:
1. Why this error occur.
2. Why documents are updated when this error occur.
I get this problem also on other collection.
Original comment by wolw...@gmail.com
on 6 Jul 2012 at 8:38
I sadly cannot reproduce your error using your version of mongodb and morphia.
I can retrieve a document from mongodb, change its contents and save the
updated document just fine. The save method does an update and inserts a new
document if it does not exist.
Can you post the code where you change your document and save it?
Original comment by sebastia...@otto.de
on 8 Jul 2012 at 9:04
My code looks like:
final Map<String, String> query = ["brochureId": brochureId,
"recipientIdentifier": recipientIdentifier]
final List<WatcherNotificationMongoDb> watcherNotifications = WatcherNotificationMongoDb.findAll(query).toList()
if (!watcherNotifications){
return
}
for(final WatcherNotificationMongoDb notification : watcherNotifications) {
if (notification.dateViewed){
log.debug("...")
} else {
notification.dateViewed = new Date()
notification.viewType = viewType
if(!notification.save()) {
log.error("...")
}
}
}
Original comment by wolw...@gmail.com
on 16 Jul 2012 at 11:50
I also can't reproduce it locally, the problem appear on production.
Original comment by wolw...@gmail.com
on 16 Jul 2012 at 11:52
Original issue reported on code.google.com by
wolw...@gmail.com
on 25 Jun 2012 at 11:45