Reputation: 205
I've set mongo database to current database using use currentdb
.
When inserting data from local host. The data keeps entering into default database "test".
Upvotes: 0
Views: 1158
Reputation: 28366
Running use <databasename>
in the shell affects only the current session.
If you then connect with node.js/mongoose and use .save(), that will be a separate session.
To find out the database being used by a mongoose connection, check the name property.
To set the database name when connecting, specify the name in the URL like:
mongoose.connect('mongodb://user:pass@localhost:port/database');
Upvotes: 2