【发布时间】:2014-06-27 04:34:04
【问题描述】:
是否可以使用 GoInstant GoAngular 通过单个数组元素查询具有数组值的键?例如,如果查询具有以下键/属性的项目列表,我可以只选择属于单个用户的项目吗?
item: {
name: 'Item name',
description: 'A longer description of the item and its details',
category: 'Business',
user_ids: [1,3,7,15] //This is an array of user id's because items
//have a many-to-many relationship with users
}
我尝试了这个查询,但它没有返回任何内容:
var queryResults = $goQuery('items', { user_ids: 1 }, { limit: 10 }).$sync();
我相信这是根据MongoDB documentation 的正确语法,但我不确定 GoInstant 是否已经实现了这个运算符。任何帮助将不胜感激。
【问题讨论】: