2 / 2
Apr 2024

how to use $set?

I want to store values within the same collection with different keys within the same collection.

for example

‘’’
db.shigihou.updateOne({ _id: “20240326165436” }, {
$set: {
“problem.categoryLevelOne.name”:“orderName”}
})
‘’’

However, “orderName” is recognized as a string.