[JAVA-2946] I have Question regarding saving java object in mongoDB and getting mongo Id back Created: 28/Aug/18 Updated: 11/Sep/19 Resolved: 29/Aug/18 |
|
| Status: | Closed |
| Project: | Java Driver |
| Component/s: | API, BSON, Codecs |
| Affects Version/s: | 3.6.0 |
| Fix Version/s: | None |
| Type: | Task | Priority: | Major - P3 |
| Reporter: | Aniket M | Assignee: | Unassigned |
| Resolution: | Duplicate | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
i am using java 1.8 and mongo java Driver version 3.6 |
||
| Issue Links: |
|
||||||||
| Description |
|
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
|
| Comments |
| Comment by Ross Lawley [ 29/Aug/18 ] |
|
I'm marking this ticket as a duplicate of Ross |