How to create primary/foreign key relationships in mongodb?
Answer Posted / 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 View All Answers