node.js - 数据未使用 mongodb 填充到 nodejs 的选项标签中
问题描述
Restaurant.aggregate([
{
"$geoNear": {
"near": customerLocation,
"distanceField": "distance",
key: "restaurantLocation",
"spherical": true,
"maxDistance": radius,
query: obj
}
},
{ $match:{userType:data.userType}},
{ $lookup: {
from: 'Tag',
let:{ tags : "$tags" },
pipeline:[
{ $match : { $expr : {$in : [ "$_id" , "$$tags"]}}}
],
as:'tags'
}},
{ $sort: sort },
{ $limit: pageOptions.limit },
{ $skip: pageOptions.page * pageOptions.limit }
])
我正在使用简单的查询根据由 0 或 1 组成的用户类型来查找附近的餐馆。0 表示餐馆,1 表示杂货店。我想用标签表查找。该字段包含对象 ID 的标记数组。我也只想填充标签结果。但没有找出为什么我的查询没有运行
解决方案
推荐阅读
- node.js - 无法为节点设置 cookie 并使用 set-cookiee 标头做出反应
- angular - azure devops 中的 CI/CD 到 Angular Web 应用程序成功但没有任何反应
- node.js - 在 VSCode 中选择从 Conda 环境安装 node.js
- php - 如何将数据库中逗号分隔的多个图像与php中的文件夹取消链接?
- android-studio - Android Emulator 正在 Android Studio 中启动,但未显示在设备选项卡中
- firebase - 如何在使用 Firebase 分析记录自定义事件时在 Firebase 控制台上查看参数?
- xcode - “找不到构建输入文件”和“构建失败”XCode
- operating-system - 应用程序可以使用 io_uring 系统调用或任何其他系统调用将数据从套接字传输到文件,同时进行零复制吗?
- object-detection - 为什么物体检测模型转换为tflite准确率下降20%
- python - 将 CrossEntropyLoss 与 LogSoftmax 一起使用