[DOCS-7854] Document how to check if a field itself is an array Created: 12/May/16 Updated: 30/Oct/23 Resolved: 16/May/17 |
|
| Status: | Closed |
| Project: | Documentation |
| Component/s: | manual |
| Affects Version/s: | None |
| Fix Version/s: | Server_Docs_20231030 |
| Type: | Improvement | Priority: | Major - P3 |
| Reporter: | Linda Qin | Assignee: | Steve Renaker (Inactive) |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||
| Participants: | |||||
| Days since reply: | 6 years, 38 weeks, 6 days ago | ||||
| Description |
|
Currently when the field is an array, $type operation on that field matches any inner element. { $type : 'array' } on that array field will match if the field has a nested array, and it will not return results where the field itself is an array. To check if a field is an array and if the array is not empty, we can use the following query:
To return the document if the field is an array (no matter if it empty or not), we can use the following query:
It would be nice to add this to the document. |
| Comments |
| Comment by Githook User [ 18/May/17 ] |
|
Author: {u'username': u'steveren', u'name': u'Steve Renaker', u'email': u'steve.renaker@mongodb.com'}Message: Signed-off-by: kay <kay.kim@10gen.com> |
| Comment by Githook User [ 14/Mar/17 ] |
|
Author: {u'username': u'atsansone', u'name': u'Tony Sansone', u'email': u'tony.sansone@mongodb.com'}Message: ( |
| Comment by Githook User [ 14/Mar/17 ] |
|
Author: {u'username': u'atsansone', u'name': u'Tony Sansone', u'email': u'tony.sansone@mongodb.com'}Message: ( |