[DOCS-1] Sequences would be better done by findandmodify Created: 10/Apr/11  Updated: 08/Sep/12  Resolved: 11/Apr/11

Status: Closed
Project: Documentation
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Karoly Negyesi Assignee: Unassigned
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Participants:
Days since reply: 12 years, 45 weeks, 3 days ago

 Description   

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,
);



 Comments   
Comment by Scott Hernandez (Inactive) [ 11/Apr/11 ]

I added an example using findAndModify w/new+upsert

When this was orig. written upsert didn't exist on findAndModify (most likely)

Generated at Thu Feb 08 07:37:43 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.