I\'m using mongoose to operate mongodb. Now, for testing, I want to inserting some data into mongodb by native connection.
But the question is how to get the generat
If you use .save then you'll get the _id back in the callback function.
var user = new User({ a: 'abc' }); user.save(function (err, results) { console.log(results._id); });