Two Way Embedding vs. One Way Embedding in MongoDB (Many-To-Many)
问题 I would like to discuss with you, if it makes any sense to use two way embedding instead of one way embedding, when modeling an N:M relationship in MongoDB. Let's say, we have two entities: A Product can belong to many (few) Categories , and a Category can have many (lots of) Products . Two Way Embedding If we use this approach, our categories would look like this: { _id: 1, name: "Baby", products: [2] } { _id: 2, name: "Electronics", products: [1, 2] } And products : { _id: 1, name: "HDMI