Skip to content

Instantly share code, notes, and snippets.

@RajeshReddyM
Created July 30, 2013 11:00
Show Gist options
  • Select an option

  • Save RajeshReddyM/6112023 to your computer and use it in GitHub Desktop.

Select an option

Save RajeshReddyM/6112023 to your computer and use it in GitHub Desktop.
Export Mongoid documents to csv from command line
1. Export documents to csv
mongoexport -d database_name -c collection_name -f field1,field2,field3 -q '{"created_at":{"$gt": new Date(1373913000000), "$lt": new Date(1375036200000)}}' --csv -o docs.csv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment