Source

						public function testUpdateWithEmbeddedObjects() {
		$data = array(
			'_id' => new MongoId(),
			'created' => new MongoDate(strtotime('-1 hour')),
			'list' => array('foo', 'bar', 'baz')
		);
		$model = $this->_model;
		$schema = array('updated' => array('type' => 'MongoDate'));
		$entity = new Document(compact('data', 'schema', 'model') + array('exists' => true));
		$entity->updated = time();
		$entity->list[] = 'dib';

		$query = new Query(array('type' => 'update') + compact('entity'));
		$result = $query->export($this->db);
		$expected = array('updated', '_id', 'created', 'list');
		$this->assertEqual($expected, array_keys($result['data']['update']));
		$this->assertTrue($result['data']['update']['updated'] instanceof MongoDate);
	}