mongodb - DBRef适合什么样的使用场景
PHP中文网
PHP中文网 2017-04-21 11:17:26
0
1
728

对MongoDB的DBRef特性非常喜欢,查询的时候能少写很多代码。

"author" : DBRef("user", ObjectId("50fb70a3674d9a02f3f2c116"))

之前一直都是用SQL,如果只保存'_id'的话觉得很简洁。但看到DBRef在数据里添加了一些其他的数据,对于有洁癖的我看着不是很爽。
但一直不清楚DBRef适合什么样的场景,所以能不能给个典型的场景示例

PHP中文网
PHP中文网

认证0级讲师

reply all(1)
迷茫

The data in mongodb is scanned by row, which means that if the value of a field is very long, mongodb will not automatically skip it but scan the entire document. When the amount of data is very dense and this is very long, When the field does not need to be retrieved frequently, it will seriously slow down the efficiency, so at this time it can be saved as a reference in other collections

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template