Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/mongodb/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Reactjs 使用mongodb和嵌入式文档集合应对查询生成器的限制_Reactjs_Mongodb_Builder - Fatal编程技术网

Reactjs 使用mongodb和嵌入式文档集合应对查询生成器的限制

Reactjs 使用mongodb和嵌入式文档集合应对查询生成器的限制,reactjs,mongodb,builder,Reactjs,Mongodb,Builder,我有两个收藏,作者和书籍,我想使用react-awesome query builder让用户可以随意查询数据,以下是我的模式和数据 作者集 {id: 1, name: 'JK Rowling', gender: 'F'}, {id: 2, name: 'Roald Dahl', gender: 'M'}, {id: 3, name: 'Dr Seuss', gender: 'M'} {id: 1, author_id: 1, title: 'Harry Potter and the Ph

我有两个收藏,作者和书籍,我想使用react-awesome query builder让用户可以随意查询数据,以下是我的模式和数据

作者集

{id: 1, name: 'JK Rowling', gender: 'F'},
{id: 2, name: 'Roald Dahl', gender: 'M'},
{id: 3, name: 'Dr Seuss',   gender: 'M'}
{id: 1, author_id: 1, title: 'Harry Potter and the Philosophers Stone', year: 1997},
{id: 2, author_id: 1, title: 'Harry Potter and the Goblet of Fire',     year: 2000},
{id: 3, author_id: 2, title: 'Charlie and the Chocolate Factory',       year: 1964},
{id: 4, author_id: 2, title: 'James and the giant peach',               year: 1961},
{id: 5, author_id: 3, title: 'Green eggs and ham',                      year: 1960},
{id: 6, author_id: 3, title: 'The cat in the hat',                      year: 1957}
藏书

{id: 1, name: 'JK Rowling', gender: 'F'},
{id: 2, name: 'Roald Dahl', gender: 'M'},
{id: 3, name: 'Dr Seuss',   gender: 'M'}
{id: 1, author_id: 1, title: 'Harry Potter and the Philosophers Stone', year: 1997},
{id: 2, author_id: 1, title: 'Harry Potter and the Goblet of Fire',     year: 2000},
{id: 3, author_id: 2, title: 'Charlie and the Chocolate Factory',       year: 1964},
{id: 4, author_id: 2, title: 'James and the giant peach',               year: 1961},
{id: 5, author_id: 3, title: 'Green eggs and ham',                      year: 1960},
{id: 6, author_id: 3, title: 'The cat in the hat',                      year: 1957}
我希望能够构建“向我显示20世纪60年代出版书籍的所有作者”的查询,并返回我mongo查询允许我进行查询,执行该查询时返回以下结果:

{id: 2, name: 'Roald Dahl'},
{id: 3, name: 'Dr Seuss'}
我不知道如何安排我的数据,一个“作者”集合和嵌入的“书籍”文档数组,或者两个单独的集合或两者的组合


Mongo可以很好地处理嵌入式文档,但不确定react-Aweasome query builder的功能?

似乎在react-Aweasome query builder中添加了$elemmatch支持,所以我只需要更改我的!结构配置到!大家好,瞧