GithubHelp home page GithubHelp logo

Comments (6)

tohagan avatar tohagan commented on June 25, 2024

Hmmm ... Maybe I just need to chat with you sometime. I think theses username are the session generated ones so probably can ignore my rant.

from superlogin.

colinskow avatar colinskow commented on June 25, 2024

CouchDB databases are very cheap. I never contemplated a compelling use case where there would be an advantage to mixing other types of docs into the sl_users database. Any custom object that has a 1:1 relationship with a user, you can safely put inside the user doc.

If you have a use case where there is a huge advantage to mix other documents into sl_users tell me about it, and I'll see what we can do to accommodate.

from superlogin.

colinskow avatar colinskow commented on June 25, 2024

If you want to chat, I am in #SuperLogin on the PouchDB Slack. Afternoon California time works best. Let me know when and we can set a time.

from superlogin.

tohagan avatar tohagan commented on June 25, 2024

Yes I understand disk space cost is very small (16k for an empty db). I understand the security model reasons for having per user dbs. I've spent the last 10 months studying everything I can find about CouchDb and PouchDb.

In my case I need to create view(s) that emit/reduce user and group objects (many to many) in the one view so these object types must share the same database. My users also have different roles per group and may eventually have additional attributes on this M:M relation. I will likely use "per user" databases as well but groups and many other shared data objects of my schema won't fit here. I will need to support replication of these and many other shared object types to other couch servers (not pouch) and having multiple replications that don't preserve object insert sequence order would be painful. I also want to be able to perform single updates with multiple doc types using bulk_update (like a transaction) which I can't do if the db is split into multiple dbs. I may also need to watch changes to these shared objects in a single change feed. I also want to only create a single validation doc in this db to manage the schema (not split it up into "per object type" databases).

So in short there are many reasons to use a single couch db for shared data. I'm sure other devs will hit the same issues. This generally means you need to use _id prefixes to avoid key collisions and ensure efficient per type queries using startkey/endkey based of the prefix which avoids overheads of maintaining a view index for each object type.

Cheers,
Tony

On 26 Apr 2016, at 4:52 pm, Colin Skow [email protected] wrote:

CouchDB databases are very cheap. I never contemplated a compelling use case where there would be an advantage to mixing other types of docs into the sl_users database. Any custom object that has a 1:1 relationship with a user, you can safely put inside the user doc.

If you have a use case where there is a huge advantage to mix other documents into sl_users tell me about it, and I'll see what we can do to accommodate.


You are receiving this because you modified the open/close state.
Reply to this email directly or view it on GitHub

from superlogin.

colinskow avatar colinskow commented on June 25, 2024

To summarize our Slack discussion, I am going to check for type === 'user' in the CouchDB views, and we will add an optional prefix to the user _id. We will also provide a conversion script to prefix the users in the database.

from superlogin.

tohagan avatar tohagan commented on June 25, 2024

Thanks Colin.

from superlogin.

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.