[SERVER-13533] Misformed update command options Created: 09/Apr/14 Updated: 10/Dec/14 Resolved: 10/Apr/14 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Shell |
| Affects Version/s: | 2.4.8, 2.4.10 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Minor - P4 |
| Reporter: | Mark Unsworth | Assignee: | Unassigned |
| Resolution: | Cannot Reproduce | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Operating System: | ALL |
| Steps To Reproduce: | With a prepopulated collection of > 1 documents execute the following command: db.my_collection.update({},{$set:{field_name:"new_value"}}, multi=true) now check the documents in the collection. None will have been updated |
| Participants: |
| Description |
|
If the options section of an update command is misformed the update fails and no error message is shown. If an equals sign is used in the place of a colon for the update options values, the update fails to execute silently. |
| Comments |
| Comment by Asya Kamsky [ 10/Apr/14 ] | |||||||||||||
|
You have to pass valid JSON document, see examples here: http://docs.mongodb.org/manual/reference/method/db.collection.update/#example-update-multi | |||||||||||||
| Comment by Mark Unsworth [ 10/Apr/14 ] | |||||||||||||
|
ok - i see now that it's just updating one at a time. The collection I was running the command on was fairly large so the one document changed wasn't noticed. Is the use of the multi=true not invalid? If i change to multi:true i get an unexpected token error:
I realise that to get it to function it needs to be in braces, my point is more on whether the previous example should also throw an exception rather than update a single document | |||||||||||||
| Comment by Asya Kamsky [ 10/Apr/14 ] | |||||||||||||
|
FYI, same result on 2.4.8
| |||||||||||||
| Comment by Asya Kamsky [ 10/Apr/14 ] | |||||||||||||
|
I tried this and the update worked successfully (on one object only)
|