Closed Morons closed 2 years ago
InsertOneResult has a [getInsertedId](https://mongodb.github.io/mongo-java-driver/4.5/apidocs/mongodb-driver-core/com/mongodb/client/result/InsertOneResult.html#getInsertedId()) method. Do you get the ObjectId with it?
Consider this:
this returns Boolean upon success or failure!
What is needed
return the record saved, including the important ObjectId if ONLY the ObjectId is returned that will help tremendously
Doing it the current way will need another call to the DB and searching for the Object as you still do not have the ObjectId therefore trying to locate the recodr can lead to errors - especailly if there is no unique field stored
Note:
Id rather have MongoDb produce the ObjectId instead of me!