[SERVER-21794] Array field limitation in query document [Only one array field may appear in the query document.] Created: 08/Dec/15 Updated: 02/Feb/16 Resolved: 02/Feb/16 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Querying |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | New Feature | Priority: | Minor - P4 |
| Reporter: | efkan turen | Assignee: | Unassigned |
| Resolution: | Duplicate | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||
| Participants: | |||||||||||||||||
| Description |
|
Hello, Related page: https://docs.mongodb.org/manual/reference/operator/projection/positional/#array-field-limitation Actually I can figure it out why this limitation is present. The issue might be regarding other operations. Especially `update`. Is there any possibility of adding a new feature which providing usage of the second array field in the query document as a new feature in the feature? It seems as a private issue. However, cannot perform two-phase commits if an array value would be updated. For instance;
|
| Comments |
| Comment by J Rassi [ 02/Feb/16 ] | ||||||||||||||||||||||||||||||||||||||||||||
|
I am closing this ticket as a duplicate of SERVER-18500. When SERVER-18500 is implemented, then the match step will associate the array offset 2 with the "invoices" array, and will associate the array offset 1 with the "pendingTransactions" array. As a result, the positional operator will correctly translate the "invoices.$.amount" path in the update to "invoices.2.amount". Please feel free to add yourself as a watcher to SERVER-18500. Note also that | ||||||||||||||||||||||||||||||||||||||||||||
| Comment by efkan turen [ 14/Dec/15 ] | ||||||||||||||||||||||||||||||||||||||||||||
|
Hi anonymous.user, When $push operator is used, everything is OK. The problem is occurred when $pull operator is used. So, please consider
Related operation: https://docs.mongodb.org/v3.0/tutorial/perform-two-phase-commits/#update-both-accounts-list-of-pending-transactions Best regards. | ||||||||||||||||||||||||||||||||||||||||||||
| Comment by Kelsey Schubert [ 14/Dec/15 ] | ||||||||||||||||||||||||||||||||||||||||||||
|
Thank you for the detailed example. I've set the fixVersion to "Needs Triage" for this new feature to be considered in the next round of planning. Updates will be posted on this ticket as they happen. Kind regards, | ||||||||||||||||||||||||||||||||||||||||||||
| Comment by efkan turen [ 09/Dec/15 ] | ||||||||||||||||||||||||||||||||||||||||||||
|
I'm writing down a fictitious document.
For updating the document using two-phase commits, the code Edit: Some additional informations; As you might imagine, if my transaction _id is 38, year is 2015, month is 8 and amount is 8888 then the document would be like the below after updating;
The reason is that the latest position of the positional operator would be 1 because of the 38 value at the second place. And thanks to positional operator place, the month 7 would be updated instead of month 8. Because month 7 in the second place. | ||||||||||||||||||||||||||||||||||||||||||||
| Comment by Ramon Fernandez Marina [ 09/Dec/15 ] | ||||||||||||||||||||||||||||||||||||||||||||
|
efkan, can you also send us a sample document from your customers database? I'm not sure I'm seeing the whole picture here. Thanks, |