我在mongodb中有一个看起来像这样的文件
{
"_id": ObjectId("5378da275ad972a811c119fb"),
"name": "test test",
"fname": "test",
"lname": "test",
"phone": "13254355554",
"user": "525518965ad972636d7aa0ae",
}
我想为" employee_id"插入一个新字段。所以结果应该是这样的。
{
"_id": ObjectId("5378da275ad972a811c119fb"),
"name": "test test",
"fname": "test",
"lname": "test",
"employee_id": "09872",
"phone": "13254355554",
"user": "525518965ad972636d7aa0ae",
}
我使用了$ push和$ addToSet,但结果变成了像
这样的数组"employee_id": {
"0": "09872",
}