DBRefI like the feature very much. I can write a lot less code when querying.
"author" : DBRef("user", ObjectId("50fb70a3674d9a02f3f2c116"))
Before, I always used SQL. If only’ _id’ is saved, I think it is very concise. However, seeing DBRef add some other data to the data, I don’t feel very good about cleanliness.
However, it is not clear what scenario DBRef is suitable for, so can you give a typical scenario example?
The data in mongodb is scanned by rows, which means that if a field has a long value length, mongodb will not automatically skip but scan the entire document. When the data volume is very dense and this long field does not need to be retrieved frequently, the efficiency will be seriously slowed down, so it can be saved as a reference in other collections at this time.