[COMPASS-7498] Export arrays creates multiple columns Created: 01/Dec/23  Updated: 08/Dec/23  Resolved: 05/Dec/23

Status: Closed
Project: Compass
Component/s: None
Affects Version/s: 1.40.3
Fix Version/s: No version

Type: Bug Priority: Critical - P2
Reporter: Mark Fallous Assignee: Unassigned
Resolution: Works as Designed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

OS:
node.js / npm versions:
Additional info:


Documentation Changes: Not Needed

 Description   

Problem Statement/Rationale

What is going wrong? What action would you like the Engineering team to take?

Please be sure to attach relevant logs with any sensitive data redacted.
How to retrieve logs for: Compass; Shell

Steps to Reproduce

How could an engineer replicate the issue you’re reporting?

Expected Results

What do you expect to happen?

Actual Results

What do you observe is happening?

Additional Notes

Any additional information that may be useful to include.



 Comments   
Comment by Rhys Howell [ 08/Dec/23 ]

tibo53@netcourrier.com I was thinking of using a string field, that might not be the format you're looking for as it'll have `"` characters leading and trailing.
Another alternative could be using `mongoexport`: https://www.mongodb.com/docs/database-tools/mongoexport/ 

Comment by Mark Fallous [ 05/Dec/23 ]

Hi rhys.howell@mongodb.com well, I keep thinking this behavior is undesirable because of the variable number of columns it produces. Could you be more precise about the aggregation pipeline? How would you transform the array column, would you convert it to a string?

Comment by Rhys Howell [ 05/Dec/23 ]

Hi tibo53@netcourrier.com, the existing csv export array field format (col[0], col[1]) is how the csv export in Compass was intentionally designed. As an alternative if you want it in that specific format you could create a pipeline aggregation to create a field on the document in the desired format. We also recommend using JSON as the primary means of importing/exporting. Thanks for creating the ticket, please do let us know if other things come up!

Comment by Mark Fallous [ 04/Dec/23 ]

Hi rhys.howell@mongodb.com, well, the problem is the following: when you export a MongoDB table as a CSV, if a field is stored an an array, multiple columns are generated in the output file (i.e. col[0], col[1], etc), which is highly undesirable. One of the sought advantages of a tabular file is to have a fixed number of columns. When a field is an array, it should be better to keep it as is (i.e. ["val1", "val2", ...]).

Comment by Rhys Howell [ 02/Dec/23 ]

tibo53@netcourrier.com Let me know the information about the issue, I can recreate the ticket or edit this one for you. I'll close the ticket for now. Thanks, interested to hear if this a bug we can fix.

Comment by Mark Fallous [ 01/Dec/23 ]

Sorry, there was an issue creating the JIRA, but I can't manage to edit it not delete it.

Comment by PM Bot [ 01/Dec/23 ]

Hello tibo53@netcourrier.com, thank you for reaching out to us! The team will review your issue and get back to you soon as soon as possible.

Please review your issue to ensure you've included your environment details and have attached relevant logs (with any sensitive data redacted), so that we're best able to provide you a timely and thorough response. Thanks again!

Generated at Wed Feb 07 22:46:45 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.