adspace


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


Please Help Members By Posting Answers For Below Questions

How did mongodb get its name?

60


what is the command syntax for inserting a document?

63


How to define array in mongoose schema?

79