1

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. 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.(this is neessary as shared database will be acessed by other applications as well).

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.

  2. 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... .

  • The document/drive/other can be shared only with all users or it can also select with whom? – Antonios Dec 30 '14 at 0:51
  • Right now, the document/drive can be shared with a user, not with all the users as of now(but that may also come into picture later on) – Kop4lyf Dec 30 '14 at 15:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.