MongoDB.live, free & fully virtual. June 9th - 10th. Register Now MongoDB.live, free & fully virtual. June 9th - 10th. Register Now

Best practices for mongodb json data

Hey everyone. So currently I store my json data in a collection unique to that type of information. So all entries are just the same json data structure with varying values for my inner keys. I was wondering if I ever wanted to map a more advanced relationship with other collection data or or other types of data how might I go about doing this? Or how should I organize this structure?

You might want to look at https://docs.mongodb.com/manual/aggregation/.

1 Like

MongoDB’s flexible schema allows data design based upon your needs. The common data relationships one-to-one, one-to-many and many-to-many can be modeled with MongoDB data. The relationships between various data entities can be organized by embedding or referencing.

If you already have the data in place or in the process of designing, there is the option to design / re-design the model using the modeling techniques specified (See Data Models).

The modeled data can be queried using the MongoDB query language, Aggregation framework or your favorite programming language / platform (like Java, Python, NodeJS, etc.).

I highly recommend you take an introductory class from MongoDB University. The introductory courses explain how to structure a document, which is basically Extended JSON. These course are offered in popular programming languages such as .NET, Node.js, and so on. They are free of charge and I feel sure you will get a lot of benefit from such a course.

Thanks so much

Bob