Git Product home page Git Product logo

couchdb-to-mongodb's People

Contributors

bhumimodi avatar jimishio avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

leafiy coinbird

couchdb-to-mongodb's Issues

sed -i causing errors

@jimishio I tried running the shell file directly and it keeps throwing error.

I used a newer npm package cloudant couchbackup instead of the deprecated couchbackup on the readme file.

The error I received was

2018-09-25T14:51:37.569+0700	Failed: error processing document #2: invalid character '{' in literal new or null (expecting 'e' or 'u')

The solution I propose is by changing the mongoimport command within the shell file to:

master_script.sh

#./master_script.sh collection_name mongo_db_name mongo_username mongo_password mongo_host mongo_port
couchbackup --db $1 > 1.json
# ./couch_to_mongo.sh 1.json
mongoimport --host $5 --port $6 --db $2 -u $3 -p $4 --collection $1 --drop --file 1.json --jsonArray --type json
rm *.json

and

master_script_without_pwd.sh

# ./master_script_without_pwd.sh collection_name mongo_db_name mongo_host mongo_port
couchbackup --db $1 > 1.json
# ./couch_to_mongo.sh 1.json
mongoimport --host $3 --port $4 --db $2 --collection $1 --drop --file 1.json --jsonArray --type json
rm *.json

Because we are passing the --jsonArray flag, there is no need to change the [,], and },{ strings with the sed command.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.