Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
In queue module fina and modify comamnd is used to get the next item and lock it. In 1.8 version of Mongo they changed what "ok" parameter in response does. Even if it doesn't find an entry it will return ok:1 and value:null which can cause errors queue processing.
Ran simple test on 2.0.4
> db.foo.find()
{ "_id" : ObjectId("4fa99312a53f69a8c09ac9f5"), "a" : 1, "b" : 2 }
{ "_id" : ObjectId("4fa99316a53f69a8c09ac9f6"), "a" : 2, "b" : 2 }
> db.runCommand({findAndModify: "foo", query: {a:1}, update:{$set:{b:3}}})
{
"lastErrorObject" : {
"updatedExisting" : true,
"n" : 1,
"connectionId" : 1,
"err" : null,
"ok" : 1
},
"value" : {
"_id" : ObjectId("4fa99312a53f69a8c09ac9f5"),
"a" : 1,
"b" : 2
},
"ok" : 1
}
> db.foo.find()
{ "_id" : ObjectId("4fa99312a53f69a8c09ac9f5"), "a" : 1, "b" : 3 }
{ "_id" : ObjectId("4fa99316a53f69a8c09ac9f6"), "a" : 2, "b" : 2 }
> db.runCommand({findAndModify: "foo", query: {a:3}, update:{$set:{b:3}}})
{ "value" : null, "ok" : 1 }
You can see that last command even though it doesn't change any documents still responds with ok:1. Attached patch checks that value is set and should work on older versions as well.
Comment | File | Size | Author |
---|---|---|---|
mongo-queue-findandmodify.patch | 636 bytes | Rok Žlender | |
Comments
Comment #1
marcingy CreditAttribution: marcingy commentedComment #2
MiSc CreditAttribution: MiSc commentedThanks.
Committed to the latest dev.