[JAVA-1340] DBCollection.save(DBObject jo) method adds new document even if the same _id already exists Created: 01/Aug/14 Updated: 03/Aug/14 Resolved: 03/Aug/14 |
|
| Status: | Closed |
| Project: | Java Driver |
| Component/s: | API |
| Affects Version/s: | 2.4 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | deepak vohra | Assignee: | Unassigned |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
Windows 7 |
||
| Description |
|
The save method adds another document with the same _id, for example 53dc0bf6c9d224c98f743a4e. |
| Comments |
| Comment by Jeffrey Yemin [ 03/Aug/14 ] | |
|
Oh, I see. You're using the String value of the ObjectId in rowUpdate. Try:
instead. | |
| Comment by deepak vohra [ 02/Aug/14 ] | |
|
//Add a row. //Obtain _id from the array output //Query row to update //Set updated values for col1 and col2 //Save updated row | |
| Comment by Jeffrey Yemin [ 02/Aug/14 ] | |
|
Hi Deepak, I'm not at all sure what you mean, as _id is unique within a MongoDB collection. Can you provide an example that shows exactly what you're seeing. Regards, |