gpt4 book ai didi

集合中每个文档的 MongoDB : how to set a new field equal to the value of another field,

转载 作者:可可西里 更新时间:2023-11-01 09:57:00 25 4
gpt4 key购买 nike

<分区>

我需要运行一个迁移脚本来将一个值(已经在每个文档中可用)插入到同一文档的数组中。必须对我收藏的每个文档执行此操作(无需选择查询)

如何改变这个:

{
"_id": ObjectID("5649a7f1184ebc59094bd8b3"),
"alternativeOrganizer": ObjectID("5649a7f1184ebc59094bd8b1"),
"myArray": []
}

进入这个:

{
"_id": ObjectID("5649a7f1184ebc59094bd8b3"),
"alternativeOrganizer": ObjectID("5649a7f1184ebc59094bd8b3"),
"myArray": [
ObjectID("5649a7f1184ebc59094bd8b3")
]
}

提前致谢。

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com