how to use $set? query is recognized as a string.

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.

Hi @kohei998morizoo, Welcome

You can use update with aggregation pipeline,