【发布时间】:2020-10-01 10:10:25
【问题描述】:
我有一个名为 Account 的收藏集 这是这个系列:
userID: "1111111111111111111"
player: {
something:{
something2: {
smth: 99
},
something3: {
smth: 88
}
}
}
我想从其他集合或 json 文件中将 something4 {smth: 77}" 添加到 something 中。
我尝试使用Collection.findOneAndUpdate 或Collection.insertOne,但没有任何效果。
【问题讨论】:
-
添加你尝试过的代码!
-
首先我使用的是这样的:sourceb.in/22bb661574 next 刚刚尝试使用 .insertOne 但在 insertOne 中找不到 userID 所以只是尝试使用 .findOneAndUpdate 但使用命令后没有任何变化。
-
您是否在 DB 上测试了您的查询?试图打印来自
.findOne()调用的输入和响应? -
当我尝试使用此代码时,我发送的内容然后对象“某物”变为字符串
标签: mongodb discord.js