【发布时间】:2021-12-05 04:30:20
【问题描述】:
有没有办法通过聚合添加值 像 db.insert_one
x = db.aggregate([{
"$addFields": {
"chat_id": -10013345566,
}
}])
我试过这个 但是这段代码什么也不返回,值也没有更新
我想通过聚合添加值 因为聚合比其他聚合快得多
示例文档:
{"_id": 123 , "chat_id" : 125}
{"_id": 234, "chat_id" : 1325}
{"_id": 1323 , "chat_id" : 335}
预期输出:
在 mongodb 聚合中替代 db.insert_one()
【问题讨论】:
-
分享示例文档和预期输出
-
@hhharsha36 检查编辑
标签: python mongodb mongodb-query