This question is regarding design of a database in mongodb.
The scenario:
A user has a drive which he can share with others. Drive has two categories: docs and others(this is neessary as shared database will be acessed by other applications as well). The user has three choices in sharing: full-drive/docs(ful or some)/other. Plus he has the ability to share the docs(any change made thereon is reflected) / provide a snapshot of when it was shared(any new change is not reflected) with an expiry time.
Requirements:
I need to have different database to store drives and files and share database to handle sharing.
How I am doing:
When he is sharing a snapshot, I copy the data from his drive to the shared database doc. But when he shares the docs permanently, I am sharing a link to the existing drive with info containing what is shared, so that I can retrieve accordingly. Plus if some of the docs are shared, then I have list of docs which I use to create view data.
Issues faced in my approach: 1. The drive should also know if it is shared with people or not. If I maintain like ids (with expiry timestamp) in the drive document, then it conflicts with the idea of having shared database, which is a necessity. If I query the shared database for getting this flag, then its just adds more time, since most of the time, user just wants to see his docs and not even worry about the sharing of it.
- If a user shares a doc/drive/otherInfo with some person, then it involves adding information in 3 or 4 collections which I am worried may fail in between. I am not sure about mongodb but I really wanted transaction like feature in here.
I want to know how I can design database for this sharing functionality in nosql scenario so this it efficiently addresses above mentioned scenario. Thanks... .
Aucun commentaire:
Enregistrer un commentaire