I create mongoose.js model:
db = mongoose.createConnection(mongoUrl)
model = db.model('Model', schema)
can I get mongoUrl (or server and DB name) from model?
Yeah, you can reference the original DB connection through model.db. So you can get all the connection information you need like this:
console.log(model.db.host); // localhost
console.log(model.db.port); // 27017
console.log(model.db.name); // myDatabase
mongoose.connection will be the same as model.db as long as your model is using the default connection, which it most probably is.
db.name,mongoose.connection.name, ormongoose.connections[0].namealso work