Coder Social home page Coder Social logo

Comments (2)

tao avatar tao commented on June 15, 2024

I have this in my system but have dealt with it in a different way.

I have a teams model which has many users, A team can represent an (github) organisation, or a project, etc. and a team belongs to a single mongo-tenant, while the users model doesn't have a mongo-tenant plugin.

So you can get the users:teams[] and users:currentTeam and retrieve mongoose models based on the current team the user is viewing.

A user may belong to many teams, so you can fetch the team model and retrieve all the users that belong to the team; or you can select a user and retrieve all the teams they belong to.

This can become very difficult to deal with, and every system may have to handle with it in very specific ways, especially when you start to consider different access rights according to tenants, or billing and subscriptions based on teams.

Perhaps you should consider thinking about another way of handling this instead of changing this mongo-tenant package to suit your requirements? As everyone else who uses this package may have different needs and it might be better to keep it as simple as possible, or create a clone and modify it for what you need.

And how will it impact performance if you have to search through arrays of multiple tenants for each query?

Just a suggestion... I'm not against any changes, I'm just saying it can become complicated very quickly and it might be better to deal with that logic on another level.

from node-mongo-tenant.

stalniy avatar stalniy commented on June 15, 2024

@tao make sense, thanks for hints!

from node-mongo-tenant.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.