MongoDB について学習していて、質問があります。多対多または多対 1 の関係をどのように表現しますか? 標準の SQL DB では、次のように簡単です。
Parent Table has fields ID (primary key) and Name.
Child Table has fields ID (primary key) and Name
Parent-Child-Relationship Table has fields ID (primary key), ParentID and ChildID
insert into table Parent (ID, Name) values (1, "Bob");
insert into table Child (ID, Name) values (1, "Mahmoud");
insert into table Parent-Child-Relationship (ID, ParentID, ChildID) values (1,1,1);
しかし、MongoDB でこれを行う方法がわかりません。私はそれをできた:
db.parent.save({name: "Bob", children: ["Mahmoud"]});
しかし、どうすればマフムードの別の親 ("Mary" と言う) を作成できるのでしょうか??
明らかな何かが欠けていますか?助けてください。私は NoSQL テクノロジーのまったくの初心者です。