[SERVER-6873] Inserting a unique value into a specific position in an array Created: 27/Aug/12 Updated: 07/Mar/14 Resolved: 27/Aug/12 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Write Ops |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | New Feature | Priority: | Major - P3 |
| Reporter: | Jan Riechers | Assignee: | Unassigned |
| Resolution: | Duplicate | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||
| Participants: | |||||||||||||
| Description |
|
Inserting an item of any type into a specific postion into existing array structure Currently $push only appends data to an array. Example data (Python array) Before: Command for example can be } # At position 1 of the myArray Result: $push is out of question as the data should be inserted to keep a order of the items. |
| Comments |
| Comment by Eliot Horowitz (Inactive) [ 27/Aug/12 ] |
|
Ah, you want insert at a given position. |
| Comment by Jan Riechers [ 27/Aug/12 ] |
|
Hi, but the $set-operator will overwrite an item, I want to add an item without removing/overwriting the one living at the particular position. |
| Comment by Eliot Horowitz (Inactive) [ 27/Aug/12 ] |
|
You can $set { $set : { "myArray.1" : ... }} |