db.collection.update( criteria, objNew, upsert, multi )
Refer to update
I have seen the following usage of {} inside update as a criteria.
collection.update({}, {$push : { x : 1}})
What is the meaning of {} here? Does it mean no criteria?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The first argument to
updatespecifies criteria used to find documents to be updated. Setting the first argument to{}, will match against every document in the collection. By default, only the first match will be updated. To update all matched documents, setmultito true.