[SERVER-10113] Reodering of update clause causes timestamp to not be auto-populated Created: 02/Jul/13 Updated: 06/Mar/14 Resolved: 08/Jul/13 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Write Ops |
| Affects Version/s: | 2.4.4 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Minor - P4 |
| Reporter: | Clifford Hammerschmidt | Assignee: | Unassigned |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Operating System: | ALL | ||||||||
| Participants: | |||||||||
| Description |
|
db.col.update({_id:1},{$setOnInsert:{ts:new BsonTimestamp(0,0)}}, {upsert:true}); should auto-populate the timestamp like a regular insert would. (i.e. if the timestamp is the first or second entry in the $setOnInsert sub-document.) |
| Comments |
| Comment by Scott Hernandez (Inactive) [ 08/Jul/13 ] | ||||||||||||||||||||
|
Update, with $mods, does not support this behavior so I've added a feature request for this: | ||||||||||||||||||||
| Comment by Sridhar Nanjundeswaran [ 05/Jul/13 ] | ||||||||||||||||||||
|
tanglebones - The above example should make it clear why I am moving it back to server. Looks you caught it as soon as I moved and before I posted my repro | ||||||||||||||||||||
| Comment by Sridhar Nanjundeswaran [ 05/Jul/13 ] | ||||||||||||||||||||
|
During an update (or upsert), the server seems to be reordering the update clause which causes the timestamp to not be populated.
Also as seen in the upsert below
| ||||||||||||||||||||
| Comment by Clifford Hammerschmidt [ 05/Jul/13 ] | ||||||||||||||||||||
|
Sridhar, I take it by your moving it back to server you don't agree with it being an issue with the C# driver? | ||||||||||||||||||||
| Comment by Daniel Pasette (Inactive) [ 02/Jul/13 ] | ||||||||||||||||||||
|
Moved this issue to the C# driver project. | ||||||||||||||||||||
| Comment by Clifford Hammerschmidt [ 02/Jul/13 ] | ||||||||||||||||||||
|
I was using the c# driver (v1.8.1) ... might be an issue with it specifically? collection.Update(Query.EQ("_id","test"),Update.SetOnInsert("ts", new BsonTimestamp(0,0)).AddToSet("state","req"), UpdateFlags.Upsert); | ||||||||||||||||||||
| Comment by Daniel Pasette (Inactive) [ 02/Jul/13 ] | ||||||||||||||||||||
|
BsonTimestamp is not defined. The following works as designed:
|