-
Type: Bug
-
Resolution: Done
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
Labels:None
http://www.mongodb.org/display/DOCS/Object+IDs#ObjectIDs-SequenceNumbers links to http://www.mongodb.org/display/DOCS/Atomic+Operations (instead of http://www.mongodb.org/display/DOCS/Atomic+Operations#AtomicOperations-%22InsertifNotPresent%22 ) but that code is not the best concurrency-wise, findandmodify is way better for sequences
we do:
$cmd = array(
'findandmodify' => mongodb_collection_name('sequence'),
'query' => array('_id' => $name),
'update' => array('$inc' => array('value' => 1)),
'new' => TRUE,
);