Skip to content

Instantly share code, notes, and snippets.

@lucianovalenca
Last active July 5, 2019 15:41
Show Gist options
  • Select an option

  • Save lucianovalenca/c78ac012ac5562b34d17fa9c395c6e9a to your computer and use it in GitHub Desktop.

Select an option

Save lucianovalenca/c78ac012ac5562b34d17fa9c395c6e9a to your computer and use it in GitHub Desktop.
insertArr = [
[
'_id' => new \MongoDB\BSON\ObjectId(),
'name' => 'teste
]
];
$collection = $this->mongo->webapp->hosting;
$collection->updateOne(
['_id' =>new \MongoDB\BSON\ObjectId($hostingId), 'rooms._id' => new \MongoDB\BSON\ObjectId($roomId)],
['$push' => ['rooms.$.media' => ['$each' => $insertArr ]]]
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment