开发者

"Pointers" in MongoDB?

In the project I am currently working on, it se开发者_如何学运维ems to make more sense efficiency wise if I create a nested document that contains a list of "pointers" to information stored in other collections. That way this nested document can be easily used to retrieve a list of relevant information. The question is, how to do this? Is there a way to store locations of other information in a field in MongoDB? If not, could anyone suggest a scheme that is equally or more efficient? Thanks very much!


There is no GOOD way to do this. If this is what you're looking for, you should be using a relational database.

But if you HAVE to go by this route then, why not store ID's in a document, and then link those ID's to documents in the other collection.

Unfortunately, this would require you to do 2 separate queries, as Mongo does not support compound queries that span documents.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜