jjzjj

php - 在使用 PHP/Phalcon/MongoDB 插入新文档期间引用现有的 ObjectId

我使用以下代码使用robomongo客户端将主要类别ID引用插入到次要类别文档varparentDoc=db.getCollection('category').findOne({"slug":"Primary"});db.category.insert({"name":"Secondary","slug":"secondary","taxonomy":true,"ancestors":[{"_id":parentDoc._id,"name":parentDoc.name}]})我试过下面的PHP风格$query='{"slug":"fashion"}';$primaryCategor