How to create primary/foreign key relationships in mongodb?



How to create primary/foreign key relationships in mongodb?..

Answer / Anuj Baliyan

MongoDB does not support traditional primary and foreign key relationships as in relational databases. Instead, MongoDB uses a document-oriented approach where each document can contain its own unique _id field, and you can reference other documents by their _id value. To create a relationship between two collections, you would store the _id of the referenced document in the referring collection.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More MongoDB Interview Questions

Does mongodb have a schema?

1 Answers  


What are indexes in mongodb?

1 Answers  


Can mongodb used for cache management?

1 Answers  


Is mongodb a firebase?

1 Answers  


What is mongoose in mongodb?

1 Answers  


Is mongodb easy to learn?

1 Answers  


Who developed MongoDB and when?

1 Answers  


Does mongodb cost money?

1 Answers  


Can I remove old files in the move chunk directory in mongodb?

1 Answers  


Is mongodb support null values?

1 Answers  


Can mongodb store binary data?

1 Answers  


In which format data is stored in mongodb?

1 Answers  


Categories