[SERVER-2070] upsertFields not updating Created: 08/Nov/10 Updated: 12/Jul/16 Resolved: 01/Dec/10 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Write Ops |
| Affects Version/s: | 1.6.4 |
| Fix Version/s: | 1.7.4 |
| Type: | Question | Priority: | Major - P3 |
| Reporter: | Simon Namikas | Assignee: | Mathias Stearn |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
Linux ubuntu 2.6.32-25-generic #45-Ubuntu SMP Sat Oct 16 19:52:42 UTC 2010 x86_64 GNU/Linux" |
||
| Attachments: |
|
| Participants: |
| Description |
|
Hello, and thank-you in advance.
I then try the following:
-> same results of prices not being updated. also, |
| Comments |
| Comment by Mathias Stearn [ 01/Dec/10 ] |
|
Oh, btw, upsert probably won't do what you want it to. It would replace the object with the matching Item Number with the lines specified (ie remove all fields other than Item Number and Price). You really want to run through all of them and do db.items.update( {"Item Number": num}, {$set:{Price: new_price}}). We don't have an automated tool to do that, but it should be easy to do with a few lines of ruby. |
| Comment by Mathias Stearn [ 01/Dec/10 ] |
|
The issue was that --upsertFields didn't imply --upsert. If you added --upsert to your first update command it would work. I've modified mongoimport to make --upsert implicit if you specify --upsertFields to hopefully prevent other people from getting confused. |
| Comment by auto [ 01/Dec/10 ] |
|
Author: {'login': 'RedBeard0531', 'name': 'Mathias Stearn', 'email': 'mathias@10gen.com'}Message: mongoimport: --upsertFields should imply --upsert |