MongoDB罗盘错误-预期为“;[“或AggregationStage,但”找到“{”
我试图在MongoDB Compass上运行以下查询,但遇到预期的“[”或AggregationStage,但“{”发现错误。我使用了为$geoNear提供的模板,但无法通过错误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
/**
* 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的附近