I need to check whether the update is successful or not:
db.$cmd.findOne({getlasterror:1})
But if someone update another document (in another connection) before the
second query, can I still know whether the first update is successful, or
the result of "db.$cmd.findOne({getlasterror:1})" is overwritten.
Actually I'm trying to implement optimistic concurrency control. In RDBMS I
can simply run the sql as below:
UPDATE TableName SET ColumnName = value WHERE Version = old_version
and then check "how many rows effected". But in MongoDB, it seems we cannot
get the number...
Jeffrey Zhao
Blog: http://blog.zhaojie.me/
Twitter: http://twitter.com/jeffz_cn
-----原始邮件-----
From: Alvin Richards
Sent: Wednesday, February 16, 2011 11:54 AM
To: mongodb-user
Subject: [mongodb-user] Re: Optimistic concurrency control in MongoDB
http://www.mongodb.org/display/DOCS/findAndModify+Command
--
You received this message because you are subscribed to the Google Groups
"mongodb-user" group.
To post to this group, send email to mongod...@googlegroups.com.
To unsubscribe from this group, send email to
mongodb-user...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/mongodb-user?hl=en.
Jeffrey Zhao
Blog: http://blog.zhaojie.me/
Twitter: http://twitter.com/jeffz_cn
-----原始邮件-----
From: Nat
Sent: Wednesday, February 16, 2011 1:27 PM
Jeffrey Zhao
Blog: http://blog.zhaojie.me/
Twitter: http://twitter.com/jeffz_cn
-----原始邮件-----
From: Alvin Richards
Sent: Wednesday, February 16, 2011 11:54 AM
To: mongodb-user
Subject: [mongodb-user] Re: Optimistic concurrency control in MongoDB
So in MongoDB there are no transaction, so each write is atomic but
http://www.mongodb.org/display/DOCS/findAndModify+Command
--
This is one of the features in morphia.