Reputation: 100130
I'd like to use a database within a database, so I have the dev DB
with my development data in it and my test DB
with all my test data. However, it doesn't look possible to put DBs inside of DBs with Mongo. So I assume an alternate solution is to create a different Mongo connection altogether for dev and test. So I have a dev_data directory and a test_data directory, each with its own mongod.lock
file and each listening on a different port. Is that a good solution? How do I do that?
Upvotes: 0
Views: 58
Reputation: 10859
This is easily possible. You can start as many mongod processes as you want like this — just make sure the data directories exist and both data folder plus log file are writeable:
mongod --dbpath /opt/dev --port 27001 --logpath /var/log/mongodb/dev.log
mongod --dbpath /opt/prd --port 27002 --logpath /var/log/mongodb/prd.log
If this is really necessary or if multiple databases would be sufficient is another matter, but you'll know best what you require for your situation.
Upvotes: 2