【MongoDB】The connection between two tables

In mongoDB, there are two general way to connect with two tables. Manual Connection and use DBRef

1. Basically manual connection 

Firstly init the data which was saved in the different collections. 

【MongoDB】The connection between two tables_第1张图片

The result:

【MongoDB】The connection between two tables_第2张图片

2 usage of  DBRef

grammar: 


the example: 

【MongoDB】The connection between two tables_第3张图片

Attention: the above example has some question;


你可能感兴趣的:(mongodb,Connection,database)