[DOCS-9024] $unwind of non-array should be allowed Created: 28/Sep/16  Updated: 30/Oct/23  Resolved: 21/Jan/18

Status: Closed
Project: Documentation
Component/s: Server
Affects Version/s: None
Fix Version/s: Server_Docs_20231030

Type: Task Priority: Major - P3
Reporter: Emily Hall Assignee: Unassigned
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Documented
documents SERVER-8088 $unwind of non-array should be allowed Closed
Participants:
Days since reply: 6 years, 3 weeks, 4 days ago

 Description   

This would effectively just output the existing field.

> db.reg.find()
{ "_id" : 1, "text" : "foo" }
{ "_id" : 2, "text" : "bar" }
{ "_id" : 3, "text" : "Bar" }
{ "_id" : 4, "text" : [ "bar", "foo" ] }
>db.reg.aggregate({$match:{text:/ba/i}}, {$unwind:"$text"})
...
	"errmsg" : "exception: $unwind:  value at end of field path must be an array",
	"code" : 15978,
	"ok" : 0

This will be important for collections where some document fields may be arrays, but some may not.



 Comments   
Comment by Kay Kim (Inactive) [ 21/Jan/18 ]

Overly aggressive ticket creation by the ticket maker script.

Generated at Thu Feb 08 07:57:26 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.