Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Is MongoDb suited for my application?

Is MongoDb suited for my application?


I'm building an application on node.js that has users and products in a many-to-many relationship (one user has many products and the same product might belong to multiple users). Each user has also location info.

Mostly I need to do a lot of writes on the user first visit (a few writes on the following visits) and then I need to match users that, for instance, have the most number of products in common and return that same products in common. I may also want to match users by location (or sort them by matching location)

I'm using postgres right now but I think I would be better of doing mongo in the long run. Problem is that I never worked on NOSQL DB (no fears ;) )

The question is, is the following "schema" suited for the described above?



I think, because of the requirements, I'm better of this way than with embeding. Am I right? Do you think I should store the products_id in the user document?


Problem courtesy of: jribeiro


Your data seems quite relational to me. I would not see a great advantage for MongoDB or NoSQL solutions. They work well for document-based solutions that aren't relational.

I would get some data if you're having problems with scaling or performance. Don't assume a solution until you know what the root cause is. It could be node.js - who knows? Some people don't care much for it.

Solution courtesy of: duffymo


View additional discussion.

This post first appeared on Node.js Recipes, please read the originial post: here

Share the post

Is MongoDb suited for my application?


Subscribe to Node.js Recipes

Get updates delivered right to your inbox!

Thank you for your subscription