I am working on a NodeJS express app using MongoDB (currently using Mongojs) and am not able to figure out how to do a certain thing with it.
I need to insert an object into a collection, and immediately get this new insert's unique identifier to store as a variable for use later in the app. I am very new to using Mongo, but as far as I can tell there is a '_id' field automatically generated as a primary key for any collection? This seems like what I need, correct me if I'm wrong.
Any assistance would be greatly appreciated. Thanks again.