Painting Blue Code
Simple, self-explanatory code snippets.
2017-01-10
MongoDB - How to update a field using the value from another field
db.
collection_name
.
find
({
filter_here_if_any
}).
forEach
( function(
doc
) {
doc
.
target_field_name
=
doc
.
source_field_name
;
db.
collection_name
.
save
(
doc
);
});
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment