Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/wcf/4.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
MongoDB罗盘错误-预期为“;[“或AggregationStage,但”找到“{”_Mongodb_Mongodb Query_Aggregation Framework_Mongodb Compass - Fatal编程技术网

MongoDB罗盘错误-预期为“;[“或AggregationStage,但”找到“{”

MongoDB罗盘错误-预期为“;[“或AggregationStage,但”找到“{”,mongodb,mongodb-query,aggregation-framework,mongodb-compass,Mongodb,Mongodb Query,Aggregation Framework,Mongodb Compass,我试图在MongoDB Compass上运行以下查询,但遇到预期的“[”或AggregationStage,但“{”发现错误。我使用了为$geoNear提供的模板,但无法通过错误 /** * options: The geo query options. */ { near: {type : "Point", coordinates : [ -153.00, 58.00 ]}, distanceField: "coordinates", maxDistance: 5000

我试图在MongoDB Compass上运行以下查询,但遇到预期的“[”或AggregationStage,但“{”发现错误。我使用了为$geoNear提供的模板,但无法通过错误

    /**
 * options: The geo query options.
 */
{
  near: {type : "Point", coordinates : [ -153.00, 58.00 ]},
  distanceField: "coordinates",
  maxDistance: 500000,
  query: Limits results that match the query
  includeLocs: Optional. Labels and includes the point used to match the document.
  num: Optional. The maximum number of documents to return.
  spherical: true
}

您能发布完整的查询吗?Aggregate希望它的第一个参数是数组,而不是对象。请尝试将
$放在
[]
stage的附近