I\'m wondering if there is a way to insert new document and return it in one go.
This is what I\'m currently using:
db.collection(\'mycollection\').i
You could use mongoose to do this. With the save method you can insert a document and return it on success. Here is an example from the mongoose documentation:
product.save(function (err, product, numAffected) {
if (err) {
// Handle error...
} else {
// Do something with the returned document...
}
})