Details
-
Bug
-
Status: Closed
-
Major - P3
-
Resolution: Duplicate
-
2.4.2
-
None
-
None
-
None
-
Ubuntu 12.10
-
Linux
-
Description
This statement did not preserve the _id's of the original (new ones were created):
// move posts to the attic
var attic = connect("localhost:27017/nomic_attic");
db.Post.find(
).sort({_id:-1}).forEach( function(vouchPost) {
attic.VouchPost.save(vouchPost);
});
I had to do this workaround to get the _id to remain unchanged in the new collection:
// move posts to the attic
var attic = connect("localhost:27017/nomic_attic");
db.Post.find(
).sort({_id:-1}).forEach( function(vouchPost) {
var copy = {};
for (var key in vouchPost) {
if (vouchPost.hasOwnProperty(key))
}
attic.VouchPost.save(copy);
});
Attachments
Issue Links
- duplicates
-
SERVER-9385 Shell ignores modified object's "_id" field
-
- Closed
-