update syntax

31 views
Skip to first unread message

mongobee

unread,
Sep 12, 2012, 1:30:18 AM9/12/12
to mongod...@googlegroups.com
db.users.update({b:'q'}, {$set:{a:1}}, false, true)
 
Above query updates value of field "a'" as 1 where field "b" is "q". What is the purpose of passing the last 2 parameters (,false, true)?

Jorge Puente Sarrín

unread,
Sep 12, 2012, 1:42:19 AM9/12/12
to mongod...@googlegroups.com
Hi,

These are optional parameters

Third parameter: upsert parameter, inserts merged document when not exists
Fourth parameter: multi parameter, updates on MongoDB defaults affects to first document, with true, update all of matched documents on collections



2012/9/12 mongobee <jja...@gmail.com>
db.users.update({b:'q'}, {$set:{a:1}}, false, true)
 
Above query updates value of field "a'" as 1 where field "b" is "q". What is the purpose of passing the last 2 parameters (,false, true)?

--
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
See also the IRC channel -- freenode.net#mongodb



--
Atte.
Jorge Puente Sarrín.

mongobee

unread,
Sep 12, 2012, 2:10:53 AM9/12/12
to mongod...@googlegroups.com
Thanks Jorge. I read the basic tutorial but did not know there is detailed documentation in the DOCS for every function. Thanks again for pointing to this link. 
Reply all
Reply to author
Forward
0 new messages