Couchdb join two documents using key

后端 未结 2 902
渐次进展
渐次进展 2020-12-06 20:51

I have two documents one with tree structure and the other one relation to the first doc. Im trying to join these two doc`s by fk and pk. I couldnt get the actual results an

2条回答
  •  佛祖请我去吃肉
    2020-12-06 21:27

    To simulate joins you have to output a doc with an _id in it, the value of the _id needs to point to an actual _id of a document. Then you can make use of include_docs=true to pull in the related documents. Example with many-to-many here: http://danielwertheim.se/couchdb-many-to-many-relations/

    If this is not applicable, you can make a two step manual join by first returning custom keys. Then make a second query against the all documents view, with multiple keys specified.

提交回复
热议问题