Skip to content

Instantly share code, notes, and snippets.

@axelvnk
Last active September 21, 2021 10:41
Show Gist options
  • Select an option

  • Save axelvnk/b3e5f7d4c48eba0975feca06248dfce4 to your computer and use it in GitHub Desktop.

Select an option

Save axelvnk/b3e5f7d4c48eba0975feca06248dfce4 to your computer and use it in GitHub Desktop.

Revisions

  1. Axel Vankrunkelsven revised this gist Nov 7, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion export.js
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,3 @@
    db.getCollection('event').find({whatever_field: 'value'}).forEach(function(u) {
    print('"' + u._id + '";"' + u.createdAt.toJSON() + '";"');
    print('"' + u._id + '";"' + u.createdAt.toJSON() + '";');
    });
  2. axelvnk created this gist Oct 30, 2017.
    3 changes: 3 additions & 0 deletions export.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,3 @@
    db.getCollection('event').find({whatever_field: 'value'}).forEach(function(u) {
    print('"' + u._id + '";"' + u.createdAt.toJSON() + '";"');
    });
    2 changes: 2 additions & 0 deletions shell_exec.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,2 @@
    mongo db_name --username db_user --password db_password export.js > export.csv