尝试在下面的JSON上做查询,从查询中得到空数组,任何线索,这是我第一次有用户pouchDb和pouchDb-find。
groupId作为参数传入,create index封装在promise中,然后在创建索引后调用_db.find。
_db.createIndex({
index: {
fields: ['og_group_ref.und[0].target_id', 'type']
}
_db.find({
selector: {
"og_group_ref.und[0].target_id": groupId
//type: 'student'
}
JSON
"og_group_ref": {"und": [{"target_id": "49"}]},任何复杂选择器的例子都会受到欢迎。
发布于 2015-07-14 21:26:12
Mango选择器语法不支持选择数组中的特定元素。您必须将字段移出数组;很抱歉。
Cloudant编辑:实际上,作为一个黑客,我认为你可以做og_group_ref.und.0.target_id,但我不知道这在Cloudant中是否有效。它可能只在PouchDB中起作用。
https://stackoverflow.com/questions/31400211
复制相似问题