【发布时间】:2021-08-16 11:28:56
【问题描述】:
我正在使用以下代码
if (typeof(searchTerm) == "string") {
let posts = await Post.reusablePostQuery([{
$match: {
$text: {
$search: searchTerm}
}
}, {
$sort: {
score: {
$meta: "textScore"
}
}
}
])
我收到以下错误
FieldPath field names may not start with '$'
【问题讨论】:
-
您正在尝试不带
aggregate关键字的聚合方法语法。 -
Post是什么?