Mongodb - 解决 ( aggregate聚合管道 ) $match 根据 id 匹配 返回 [ ] 的问题
时间:2020-01-19 18:38:50
收藏:0
阅读:292
需要对 id 进行转换
const mongoose = require(‘mongoose‘)
var ObjectId = mongoose.Types.ObjectId;
await Users.aggregate([
{
$match : { "_id":new ObjectId("5asdasdasc66b6aae717b")}
}
])
原文:https://www.cnblogs.com/500m/p/12215087.html
评论(0)