EricC
EricC

Reputation: 5870

MongoDB: How to organize data

I am a little bit uncertain on how to organize the data when using MongoDB.

I have a user with some various data. Say a classified service, with a profile and possibly some items for sale. In a relational database this data would be split up into a profile table and a for-sale table. As I understand in MongoDB this would probably all go into one "document" (well, probably except if there is very large number of items for sale).

But my classified service is a little bit special, as for each item for sale, an administrator (salesman) adds stuff to the item for sale, such as allow the ad to go public, a comment on the item and possibly more. The user should obviously not be able to alter this admin-added info.

What would be the recommended way to deal with this? Can the administrator just change (add to) the users item-document? But I guess the user can then change what the administrator has added, right? So perhaps a better approach would be for the admin to create another document that contains the added data, and these two documents would be merged before being displayed?

Upvotes: 3

Views: 5078

Answers (1)

Drew
Drew

Reputation: 2663

Maybe the following may be helpful: http://docs.mongodb.org/manual/applications/data-models/?

Also, http://docs.mongodb.org/manual/data-modeling/

Upvotes: 3

Related Questions