Unfortunatelly all my Mongo collections have _id as integer, instead of Object ID. I'm trying to amend that with Robomongo client, and I'm trying with that command:
db.getCollection('client').find({}).forEach(function(doc){
var doc2 = doc;
doc2._id = new ObjectId();
db.collection1.insert(doc2);
});
Unfortunatelly the documents are not inserted or changed, although I get this output:
Inserted 1 record(s) in 1ms
Inserted 1 record(s) in 1ms
Inserted 1 record(s) in 1ms
Inserted 1 record(s) in 1ms
Inserted 1 record(s) in 1ms
Inserted 1 record(s) in 1ms
How should I change the command above to make it working?