I'm trying to make a bulk insert from the MongoDB console of an array into a collection.
I'd like to do something similar to this.
obj1 = {_id:ObjectId(),blabla:1};
obj2 = {_id:ObjectId(),blabla:2};
objs = [obj1, obj2];
db.test.insert(objs);
db.test.find()
> {"_id": ObjectId("xxxx"), "blabla": 1} > {"_id": ObjectId("xxxx"), "blabla": 2}
But, instead of inserting two objects on the collection, it stores one list with the two objects.
db.test.find()
> {"_id": ObjectId("xxx"), "0":{"_id": ObjectId("xxxx"), "blabla": 1}, "1":{"_id": ObjectId("xxxx"), "blabla": 2} }
That functionality appears to present on other drivers (like pymongo), but I can't find a way of doing that from the mongodb console, in JavaScript code.