mongodb - Why does my Google Compute Engine instance make Mongo return incorrect results? -
on google compute debian instance, 2 concurrent mongo findoneandupdate
in mongo shell make second 1 return null
, though there plenty items left process. not happen on other hardware (like macbook pro on macos sierra) using same database , version numbers.
what makes difference:
- removing sort; either because problem goes away, or because query fast chances of collision small.
- as said; running same mongodb version on different hardware/os (don't have access debian jessie on own hardware).
what not make difference: adding/removing indices, returnoriginal
.
background info:
- google compute engine n1-highmem-2 (2 vcpus, 13 gb memory) instance
- running debian jessie
- mongodb version 3.4.3
the collection contains 1.8 million records. here's query ; names have been changed protect innocent:
db.mycollection.findoneandupdate( { "foo" : { "$exists" : 1 }, "baz.pid" : { "$exists" : 0 }, "$or" : [ { "baz.completed" : { "$exists" : 0 } }, { "baz.completed" : { "$lt" : isodate("2017-03-07t19:02:35.422z") } } ] }, { $set: { baz: { started: new date(), pid: 42 } } }, { sort: { prio: -1 }, returnoriginal: false } );
Comments
Post a Comment