How to run multiple mongodb databases with same name on single mongodb instance?

5/13/2019

We are trying to minimize CI pipeline resource usage by running multiple apps (dev branch deployments of the same app) on a single physical mongodb instance.

How can this be done best?

Currently each branch has its own physical mongodb instance.

The system has multiple logical databases for each single branch deployment.

Example of current state:

  • Branch A -> programatically (node.js) spawns own mongodb with logical databases UserDb, EventDb, CarDb
  • Branch B -> also spawns its mongodb with logical databases UserDb, EventDb, CarDb

Goal:

  • single, shared mongodb instance
  • Branch A -> logical databases UserDb, EventDb, CarDb running on the single mongodb instance
  • Branch B -> same
  • databases of Branch A and B are independent
-- ProSinq
continuous-integration
kubernetes
mongodb

1 Answer

5/17/2019

The best way of doing this will be to call the databases different names (like branch_b_UserDb, branch_b_EventDb, etc).

by willis in How to run multiple mongodb databases with same name on single mongodb instance?

-- ProSinq
Source: StackOverflow