Mongo
PHP Manual

The MongoEmptyObj class

소개

This class is used to insert an empty object into the database.

Inserting an empty array will create an array-type document, which can be used for (among other things) $push updates:

<?php
$collection
->insert(array('x' => array()));
?>

The shell shows that an empty array is saved as an array:

> db.collection.findOne()
{ 'x' : [] }

Inserting a MongoEmptyObj will create an object-type document:

<?php
$collection
->insert(array('x' => new MongoEmptyObj()));
?>

The shell shows that a MongoEmptyObj is saved as an object:

> db.collection.findOne()
{ 'x' : {} }

클래스 개요

MongoEmptyObj
MongoEmptyObj {
}

Mongo
PHP Manual