Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/40.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
Node.js 无法分析:筛选器:mongoDB错误_Node.js_Mongodb_Robo3t - Fatal编程技术网

Node.js 无法分析:筛选器:mongoDB错误

Node.js 无法分析:筛选器:mongoDB错误,node.js,mongodb,robo3t,Node.js,Mongodb,Robo3t,我正在尝试从带有日期范围字段的集合中查询数据,我的文档已实现正则表达式搜索 我的问题如下: db.getCollection('_event').find([{"name":{"$regex":"2017","$options":"i"}},{},{"date.start:{$gte":"2017-03-07T18:30:00.000Z"},{"date.end:{$lt":"2017-11-16T18:30:00.000Z"}]) mongo抛出了一个错误 错误:错误:{waitedMS:

我正在尝试从带有日期范围字段的集合中查询数据,我的文档已实现正则表达式搜索

我的问题如下:

 db.getCollection('_event').find([{"name":{"$regex":"2017","$options":"i"}},{},{"date.start:{$gte":"2017-03-07T18:30:00.000Z"},{"date.end:{$lt":"2017-11-16T18:30:00.000Z"}])
mongo抛出了一个错误

错误:错误:{waitedMS:NumberLong0,确定:0,errmsg: 无法分析:筛选器:[{name:{$regex:\2017\,$options: \i\},{},{date.start:{$gte:\2017-03-07T18:30:00.000Z\}{ 日期.结束:{$lt:\2017-11-16T18:30:00.000Z\}]。“筛选器”字段必须 属于BSON类型对象,代码:9}

有任何帮助吗?

find方法的参数必须是JSON/BSON文档,而不是列表。请重试

db.getCollection('_event').find({
       "name":{"$regex":"2017","$options":"i"},
       "date.start":{"$gte":"2017-03-07T18:30:00.000Z"},
       "date.end":{"$lt":"2017-11-16T18:30:00.000Z"}
})