In Mongodb, how do I add a field to every record? -
i want add field "bio" "about" section of document.
i suppose you're using mongo console. add field each document in collection have use command:
db.foo.update({},{$set : { "about.bio" : ""}} , true, true);
of course have replace foo
real collection name. command use empty string (""
) default value new field: can change behaviour changing value in command.
hope helps
Comments
Post a Comment