我正在使用以下代码
if (typeof(searchTerm) == "string") {
let posts = await Post.reusablePostQuery([{
$match: {
$text: {
$search: searchTerm}
}
}, {
$sort: {
score: {
$meta: "textScore"
}
}
}
])
我收到以下错误
<块引用>FieldPath field names may not start with '$'
答案 0 :(得分:0)
我也遇到了同样的问题,但是当我删除 在它对我有用之前在代码和逗号(,)下面
{
$sort: {
score: {
$meta: "textScore"
}
}
}