[英]Meteor Collection.find() everything except a value
I want meteor to return all Items that have not been marked as inactive. 我希望流星返回所有尚未标记为非活动的项目。 The inactive flag is just set if the item is marked inactive. 如果项目标记为非活动,则仅设置非活动标志。
Marking an Item as inactive: 将项目标记为无效:
Template.displayedItems.events({
'change [type=checkbox]': function(event) {
var checked = $(event.target).is(':checked');
Items.update(this._id, {$set: {inactive: checked}});
}
How do I have to query to get all items that are not inactive? 如何查询以获取所有非活动项目?
如果要获取未设置inactive
字段值的文档,则可以使用$ exists
Items.find({inactive : { $exists: false }})
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.