mongodb - db.collection.update( ) all documents -


i try rename 1 field in documents of collection,

db.coll.update({},{ $rename: {'originfield':'newfield'} }); 

but 1 document changed, why ?

all updates in mongodb are, default, singular. must add third option command make:

db.coll.update({},{ $rename: {'originfield':'newfield'} }, {multi:true}); 

Comments