How to the get the _id property of a freshly inserted MongoDB entry

Node's mongo driver appends the returned ```_id``` field to the original object reference.

```
myCollection.insert(myObject, () => { 
	const {_id } = myObject
  return _id;
})

```

Nick Ciolpan
15 Nov 2022
« Back to post