[JAVA-2284] The updateOne command with upsert option does not work if document does not exist already. Created: 20/Aug/16 Updated: 11/Sep/19 Resolved: 29/Aug/16 |
|
| Status: | Closed |
| Project: | Java Driver |
| Component/s: | Async |
| Affects Version/s: | 3.3.0 |
| Fix Version/s: | None |
| Type: | Task | Priority: | Major - P3 |
| Reporter: | Tareq Nabeel | Assignee: | Unassigned |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Description |
|
The updateOne command below works with MongoDB Java driver 3.3.0 but does not work with MongoDB Async Java driver 3.3.0. MongoAsync Driver does not work:
Mongo driver works:
The MongoAsync driver does not report any issues. The document simply does not get inserted if the query document does not match. |
| Comments |
| Comment by Jeffrey Yemin [ 29/Aug/16 ] | |||||||||||||||||||||||||||||||||||||
|
Not a problem. Just add a comment if you find anything relevant. | |||||||||||||||||||||||||||||||||||||
| Comment by Tareq Nabeel [ 29/Aug/16 ] | |||||||||||||||||||||||||||||||||||||
|
I'm unable to reproduce this issue in a standalone program. I'm now unable to reproduce this in my application as well. I went through a series of changes.. .I can't remember the exact combination that produced the issue:
For a brief moment last week, when I had zero records in my collection and I used MongoAsync upsert/updateOne, I was not getting my record inserted. I replaced the client with Mongo and it worked. I have a wrapper around the two interfaces (MongoDbAsync/MongoDb), so it's easy for me to switch back and forth. I went back-n-forth last week between the two interfaces and I was consistently getting success with MongoDb and failure with MongoDbAsync. That's what prompted me to create the ticket. I have since made more changes in my application. Not sure if that's why it's now working with MongoDbAsync. I'll keep any eye on this and re-open the ticket with more details next time should I see it again. I will make sure to reproduce it in a standalone program before re-opening it. We can close the ticket for now. Sorry for wasting your time. | |||||||||||||||||||||||||||||||||||||
| Comment by Tareq Nabeel [ 22/Aug/16 ] | |||||||||||||||||||||||||||||||||||||
|
Jeff, | |||||||||||||||||||||||||||||||||||||
| Comment by Jeffrey Yemin [ 22/Aug/16 ] | |||||||||||||||||||||||||||||||||||||
|
Hi Tareq, I'm not able to reproduce this with the following test program:
The output is:
Can you provide a complete test program that demonstrates the incorrect behavior? |