[SERVER-40185] stitch lib handles initialization for upserted doc differently than server when update is a replacement Created: 18/Mar/19 Updated: 29/Oct/23 Resolved: 12/Apr/19 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Querying |
| Affects Version/s: | None |
| Fix Version/s: | 4.1.11 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Michael O'Brien | Assignee: | Justin Seyster |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||
| Backwards Compatibility: | Fully Compatible | ||||
| Operating System: | ALL | ||||
| Sprint: | Query 2019-04-22 | ||||
| Participants: | |||||
| Description |
|
With an empty data set, running an update operation against the server to perform a document replacement uses the _id in the query to initialize it: local:PRIMARY> db.test.update({$and:[{_id: 1000}]}, {foo:10000}, {upsert:true}) WriteResult({ "nMatched" : 0, "nUpserted" : 1, "nModified" : 0, "_id" : 1000 }) local:PRIMARY> db.test.find() {{ { "_id" : 1000, "foo" : 10000 }}}
However doing the equivalent operation through the stitch library doesn't seem to take into account the query when initializing the upserted doc in the same manner. Here is a failing test case:
Interestignly though the same operation does work equivalently to the server when the update uses $ modifiers instead. For example, the following test passes:
|
| Comments |
| Comment by Githook User [ 12/Apr/19 ] |
|
Author: {'email': 'justin.seyster@mongodb.com', 'name': 'Justin Seyster', 'username': 'jseyster'}Message: |