Specifying Column Order when Exporting CSV

Randy AufDerHeide shared this question 47 days ago
Answered

When exporting data as csv, is it possible to specify the column order?

It would make our import/exports into Google Sheets a lot easier.

Replies (1)

photo
1

There is a work-around solution. NoSQLBooster can export query results. You can add field selection(.project) and sorting methods(.sort) to the query. You can also use the one-click projecting and one-click sorting operation to generate related query code. Then export the query to a CSV file.

BTW, you can export the dataset to excel and then use excel for field selection and sorting.

408c9ccd9c3be0ed801f4e676e5a352c

For example:


db.unicorns
    .find({})
    .projection({  //select your columns
        name: 1,
        loves: 1,
        weight: 1,
        gender: 1
    })
    .sort({ //sorting
        weight: -1,
        gender: -1
    })
    .limit(11)

Leave a Comment
 
Attach a file