Skip to content

Instantly share code, notes, and snippets.

@amanrx07
Last active January 2, 2016 00:49
Show Gist options
  • Select an option

  • Save amanrx07/8225967 to your computer and use it in GitHub Desktop.

Select an option

Save amanrx07/8225967 to your computer and use it in GitHub Desktop.

Revisions

  1. aman singh revised this gist Oct 7, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion mongo_import.sh
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    #!/bin/bash

    host=localhost
    db=hoppr_services_development
    db=mydatabase

    for bson_file in `ls *.bson`
    do
  2. aman singh revised this gist Jan 2, 2014. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions mongo_import.sh
    Original file line number Diff line number Diff line change
    @@ -1,12 +1,12 @@
    #!/bin/bash

    HOST=localhost
    DB=hoppr_services_development
    host=localhost
    db=hoppr_services_development

    for bson_file in `ls *.bson`
    do
    echo "importing $bson_file"
    collection=$(echo "${bson_file}" | cut -d'.' -f1)
    bson_path="$(pwd)/$bson_file"
    mongoimport --host $HOST --db $DB --collection $collection $bson_path
    mongoimport --host $host --db $db --collection $collection $bson_path
    done
  3. aman singh revised this gist Jan 2, 2014. 2 changed files with 12 additions and 9 deletions.
    12 changes: 12 additions & 0 deletions mongo_import.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,12 @@
    #!/bin/bash

    HOST=localhost
    DB=hoppr_services_development

    for bson_file in `ls *.bson`
    do
    echo "importing $bson_file"
    collection=$(echo "${bson_file}" | cut -d'.' -f1)
    bson_path="$(pwd)/$bson_file"
    mongoimport --host $HOST --db $DB --collection $collection $bson_path
    done
    9 changes: 0 additions & 9 deletions mongo_recover.sh
    Original file line number Diff line number Diff line change
    @@ -1,9 +0,0 @@
    #!/bin/bash

    for name in `ls *.bson`
    do
    echo "importing $name"
    col=$(echo "${name}" | cut -d'.' -f1)
    FILE_PATH="$(pwd)/$name"
    mongoimport --host localhost --db hoppr_services_development --collection $col $FILE_PATH >> $(pwd)/import.log
    done
  4. aman singh created this gist Jan 2, 2014.
    9 changes: 9 additions & 0 deletions mongo_recover.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,9 @@
    #!/bin/bash

    for name in `ls *.bson`
    do
    echo "importing $name"
    col=$(echo "${name}" | cut -d'.' -f1)
    FILE_PATH="$(pwd)/$name"
    mongoimport --host localhost --db hoppr_services_development --collection $col $FILE_PATH >> $(pwd)/import.log
    done