[DOCS-10226] New behavior for {field: {$type: "array"}} Created: 08/May/17 Updated: 29/Oct/23 Resolved: 18/Sep/17 |
|
| Status: | Closed |
| Project: | Documentation |
| Component/s: | Server |
| Affects Version/s: | None |
| Fix Version/s: | 3.5.7 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | David Storch | Assignee: | Pavithra Vetriselvan |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Participants: | |||||||||
| Days since reply: | 6 years, 22 weeks, 6 days ago | ||||||||
| Epic Link: | DOCS: 3.6 Server | ||||||||
| Description |
|
In https://docs.mongodb.com/manual/reference/operator/query/type/ Specifically, we changed the behavior of $type:"array". Previously, such a query would only match documents with nested arrays:
The new behavior, which we believe to be more intuitive and more consistent with existing query semantics, is to match both nested arrays and non-nested arrays:
This change needs to be documented as part of the Compatibility Changes page in the 3.6 release notes. We also need to update the Querying by Array Type section for the 3.6 references pages, since this currently is dedicated to describing the old behavior. |
| Comments |
| Comment by Githook User [ 07/Sep/17 ] |
|
Author: {'name': 'Pavithra Vetriselvan', 'email': 'pavi@MacBook-Pro-77.local'}Message: |
| Comment by Githook User [ 07/Sep/17 ] |
|
Author: {'name': 'Pavithra Vetriselvan', 'email': 'pavi@MacBook-Pro-77.local'}Message: |
| Comment by David Storch [ 12/May/17 ] |
|
One more very important point: this change will affect users on 3.4.x who have partial indexes whose partialFilterExpression has a $type:"array" expression and wish to upgrade to 3.6. As part of the upgrade process, such users must rebuild any such partial index when first starting a 3.6 node. Failing to do so could cause the user to experience a mix of the old and new $type:"array" semantics. We should clearly document this wrinkle in the 3.6 compatibility notes so that users who may be affected can take the appropriate action. Note that everything said in this ticket also applies to $type:4, since 4 is the type code for BSON arrays. |
| Comment by Ravind Kumar (Inactive) [ 08/May/17 ] |