我的 MongoDB 内容(当我使用 find() 时)是这样的:
{
"_id": ObjectId("50072b17b4a6de3b11000001"),
"addresses": [
{
"_id": ObjectId("50072b17b4a6de3b11000004"),
"address1": "770 27th Ave",
"address2": null,
"city": "San Mateo",
"country": "United States",
"country_code": "US",
"name": "home",
"primary": true,
"state": "California",
"zip": "94403"
}
],
"biography": null,
"category_ids": [],
"department": null,
"emails": [
{
"_id": ObjectId("50072b17b4a6de3b11000003"),
"_type": "Email",
"name": "work",
"email": "alan@altimetergroup.com"
}
]
}
我需要做的是我需要用其他数据更新这个 MongoDB。为此,我需要将 php 中的值作为数组获取并将该数组插入到该集合中。如何在 php 中将这些指定字段的值作为数组获取以及如何在 php 中插入这些值?