javascript - NodeJS/MongoDB - Clone Collection with Indexs -
i'm trying clone mongodb collection indexs 2 different mongodb instances. after googling around, found clonecollection best bet. i've tried make code nice , simple, never seem actual clone command run. 'started' , 'authed' pop in console, command never runs. i'm doing wrong? thanks.
mongodb = require("mongodb") ##################### # mongodb config ##################### console.log "started" server = mongodb.server db = mongodb.db server = new server("example.com", 27017, {}) db = new db("databasetwo", server, safe: true ) db.open (err, db) -> db.authenticate "user", "password", (err, res) -> throw err if err console.log "authed" db.command clonecollection: "databaseone.hellotherecollection" from: "example.com:6001" key: username: 'user' password: 'password' , (err, cb) -> console.log err if err console.log 'command ran' cb null
Comments
Post a Comment