hex7c0 / mongodb-restore

restore data from mongodb-backup for Nodejs
https://github.com/hex7c0/mongodb-restore
Apache License 2.0
53 stars 21 forks source link

Support mongodb+srv:// URI format, update to driver v3 #19

Open Phoscur opened 6 years ago

Phoscur commented 6 years ago

The new 3.6 driver and the MongoDB Cloud support a new URI format mongodb+srv://

I was able to restore with the old (convoluted) format though.

New URI example:

mongodb+srv://user:pass@leby-rld09.mongodb.net/test?retryWrites=true

Error

Error: invalid schema, expected mongodb
    at module.exports (C:\Projects\leby\node_modules\mongodb-restore\node_modules\mongodb\lib\url_parser.js:18:11)
    at connect (C:\Projects\leby\node_modules\mongodb-restore\node_modules\mongodb\lib\mongo_client.js:289:16)
    at Function.MongoClient.connect (C:\Projects\leby\node_modules\mongodb-restore\node_modules\mongodb\lib\mongo_client.js:113:3)
    at go (C:\Projects\leby\node_modules\mongodb-restore\index.min.js:138:115)
    at Extract.<anonymous> (C:\Projects\leby\node_modules\mongodb-restore\index.min.js:194:60)
    at Extract.emit (events.js:185:15)
    at DirWriter.<anonymous> (C:\Projects\leby\node_modules\tar\lib\extract.js:82:8)
    at DirWriter.emit (events.js:185:15)
    at end (C:\Projects\leby\node_modules\fstream\lib\writer.js:324:14)
    at C:\Projects\leby\node_modules\fstream\lib\writer.js:314:34

Old format example:

mongodb://user:pass@leby-shard-00-00-rld09.mongodb.net:27017,leby-shard-00-01-rld09.mongodb.net:27017,leby-shard-00-02-rld09.mongodb.net:27017/Leby?ssl=true&replicaSet=leby-shard-0&authSource=admin&retryWrites=true