I use NodeJS to insert documents in MongoDB. Using collection.insert I can insert a document into database like in this code:
collection.insert
// ... collection.
There is a second parameter for the callback for collection.insert that will return the doc or docs inserted, which should have _ids.
Try:
collection.insert(objectToInsert, function(err,docsInserted){ console.log(docsInserted); });
and check the console to see what I mean.