Skip to content

connect Multiple Mongodb database with single interface #15045

Open
@KTBsomen

Description

Prerequisites

  • I have written a descriptive issue title
  • I have searched existing issues to ensure the feature has not already been requested

🚀 Feature Proposal

I just need more space so I created two different database and now I want to Marge all the database into single database so I can query it as a single database instance.

I just created a npm package called mongoplusplus to do the same. but I want this feature in native mongoose if possible.

also it dose the job well for my requirement but I am not 100% confident about the performance and security of my package and moreover the documentation kind of sucks so if anyone can help me evaluate the project that will be greatness at it's peak.

GitHub link of my package
https://github.com/KTBsomen/mongoplusplus

Motivation

lack of money and low free tier of mongodb. nothing fits into 512 MB

Example

it will just work like
i have connection uris of mongodb database
i will pass them to my constructor it will handle all the connections.

const dbname = 'testforUP';

const mongoURI1 = `mongodb+srv://xxxxx:[email protected]/${dbname}?retryWrites=true&w=majority`;
const mongoURI2 = `readonly:mongodb+srv://xxxxxxx:[email protected]/${dbname}?retryWrites=true&w=majority`;
const mongodb = new mongoplusplus([mongoURI1, mongoURI2]);

now mejority of the function are the same like creating schemes, building models.
one key difference is I will have some extra query method to query all the database at once or just anyone of them.

const result = await likes.findInAllDatabase({ name: 'John' }, { limit: 10, skip: 0 });
Returns: An array of documents matching the filter from all databases.

like so on. you can check my current implementation on GitHub

https://github.com/KTBsomen/mongoplusplus

Metadata

Assignees

No one assigned

    Labels

    enhancementThis issue is a user-facing general improvement that doesn't fix a bug or add a new featurenew featureThis change adds new functionality, like a new method or class

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions