Previous answers helped me but the exact answer I was looking for was passing more arguments in update callback like below:
myCollection.update(..., {upsert : true}, function(err, numberAffected, raw) {
console.log(raw);
}):
if the update was an insert you get item's _id from raw.upserted updatedExisting: false, upserted: 52f6b9756268a019bd11d0fb,
Ref:
https://groups.google.com/d/msg/mongoose-orm/ehZ11QY-OUw/-ex7ekL2c9sJ https://github.com/mafintosh/mongojs/issues/39