Hi Team ,
I saving my java object to mongo DB using proper codec and able to save object in mongo
i am using collection.insertOne(javaObject);
i have @BsonId ObjectId id in my class . when i save object to database i don't see database generated id reflecting in ObjectId id (i see this is as null , even after saving object to DB) field of my class .
to get this DB generated Id so i have to query mongo Db one more time or there is some other way to do so ?
Could you please help with above .
Thanks..!
Aniket
- duplicates
-
JAVA-2674 POJO ID property is not populated after insert
- Closed