Hi
But wanted to know is there any possibility without giving index number and Export all the array data in csv format
Did I understand correctly that you wanted to export e.g. this document:
{_id: "xyz", field1: "x", field2: [ {a: 1, b: 2, c: 3} ] }
into its CSV representation?
I’m not aware of a method to do so using mongoexport
, since the two representations are quite different (the MongoDB representation is a document, and the CSV representation is tabular). Without precise information on how to “unwind” the document into its tabular form, mongoexport
cannot know how you want your data to be represented.
Alternatively, you might be able to create a temporary collection such as using the aggregation framework’s $out stage to craft the representation that can be exported easily by mongoexport
.
Best regards,
Kevin