Modeling Data Relationships in MongoDB

[The tutorial is originally written for]

It’s important to consider the data needs of your application right from the very start of development. But if your app will be using NoSQL and you come from a RDBMS/SQL background, then you might think looking at data in terms of NoSQL might be difficult. This article will help you by showing you how some of the basic data modeling concepts apply in the realm of NoSQL.

I’ll be using MongoDB for our discussion as it is one of the leading open-source NoSQL databases due to its simplicity, performance, scalability, and active user base. Of course the article assumes that you are aware of basic MongoDB concepts (like collections and documents). If not, I suggest you read some of the previous articles here at PHPMaster to get started with MongoDB.

Read my full article here.


One thought on “Modeling Data Relationships in MongoDB

  1. In Modeling Many-to-Many Relationships (M:N), what is the problem if we have 1000 users purchase 1 item like this:

    “_id”: “item1”,
    “purchased_by”: {
    “0”: “user1”
    “1”: “user2”
    “2”: “user3”

    “999”: “user1000”


    Is there any problem?

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s