[SERVER-2369] mongoexport doesn't support specifying fields within arrays in the field selector Created: 17/Jan/11  Updated: 12/Jul/16  Resolved: 17/Jan/11

Status: Closed
Project: Core Server
Component/s: Tools
Affects Version/s: 1.6.3
Fix Version/s: 1.7.5

Type: Bug Priority: Minor - P4
Reporter: raulvk Assignee: Eliot Horowitz (Inactive)
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Linux, 32-bit version


Backwards Compatibility: Fully Compatible
Operating System: ALL
Participants:

 Description   

Specifying a field selector that contains fields within arrays when calling the mongoexport utility has unexpected behaviour, at least when exporting to CSV.
E.g. You have the following document in your db:

{"id_": "username1",
"telephones":
[

{"type": "mobile", "value":101010}

,

{"type": "landline", "value": 202020}

]
}

Running the following doesn't return the expected results:

mongoexport --csv -f '_id,telephones[0].value,telephones[1].value'



 Comments   
Comment by auto [ 17/Jan/11 ]

Author:

{u'login': u'erh', u'name': u'Eliot Horowitz', u'email': u'eliot@10gen.com'}

Message: fix projecton generation for export since it uses getFieldDotted SERVER-2369
https://github.com/mongodb/mongo/commit/880a77542336fedbc0efa5cb69227425398fb26f

Comment by Eliot Horowitz (Inactive) [ 17/Jan/11 ]

Was broken, but correct syntax is

mongoexport --csv -f '_id,telephones.0.value,telephones.1.value'

fix coming.

Generated at Thu Feb 08 02:59:45 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.