joining two collections in json store

落爺英雄遲暮 提交于 2019-12-12 02:07:18

问题


Is it possible to join two collections in JSONStore?

I want to access data from the given two collections in the json store one of which has a foreign key.


回答1:


There's nothing equivalent to a join in Relational Databases for JSONStore. However, like Namfo said in the other answer, you may take advantage of additionalSearchFields for this use case. It allows you to index values that are not part of the data being stored. For example, if you have a order collection and are storing objects like {item: 'knife'} you could have an additional search field for customer_id which references an id search field in the customer collection. Here is a post that explains additional search fields.




回答2:


JSONSTORE does not have the ability to combine collections. However, you can use a common index between the two collections to access relevant data. For instance, order_id search field can be shared between the customer collection and order collection.



来源:https://stackoverflow.com/questions/28408301/joining-two-collections-in-json-store

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!