Commit ca084014 authored by Jeremy Mikola's avatar Jeremy Mikola

Merge branch 'v1.1'

parents 6385fe0b 6b763fb0
...@@ -68,7 +68,7 @@ special BSON type, the query criteria for selecting a restaurant must use the ...@@ -68,7 +68,7 @@ special BSON type, the query criteria for selecting a restaurant must use the
$restaurant = $database->restaurants->findOne([ $restaurant = $database->restaurants->findOne([
'_id' => new MongoDB\BSON\ObjectID('594d5ef280a846852a4b3f70'), '_id' => new MongoDB\BSON\ObjectID('594d5ef280a846852a4b3f70'),
]) ]);
Projecting Fields Projecting Fields
~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~
......
...@@ -75,18 +75,21 @@ The following example finds and deletes the document with ``restaurant_id`` of ...@@ -75,18 +75,21 @@ The following example finds and deletes the document with ``restaurant_id`` of
The output would then resemble:: The output would then resemble::
object(stdClass)#14 (4) { object(MongoDB\Model\BSONDocument)#17 (1) {
["_id"]=> ["storage":"ArrayObject":private]=>
object(MongoDB\BSON\ObjectID)#11 (1) { array(4) {
["oid"]=> ["_id"]=>
string(24) "576023c6b02fa9281da3fad9" object(MongoDB\BSON\ObjectID)#11 (1) {
["oid"]=>
string(24) "594d5ef280a846852a4b3f70"
}
["borough"]=>
string(9) "Manhattan"
["name"]=>
string(15) "Agra Restaurant"
["restaurant_id"]=>
string(8) "40375376"
} }
["borough"]=>
string(9) "Manhattan"
["name"]=>
string(15) "Agra Restaurant"
["restaurant_id"]=>
string(8) "40375376"
} }
See Also See Also
......
...@@ -113,27 +113,33 @@ The following operation replaces the document with ``restaurant_id`` of ...@@ -113,27 +113,33 @@ The following operation replaces the document with ``restaurant_id`` of
[ 'returnDocument' => MongoDB\Operation\FindOneAndReplace::RETURN_DOCUMENT_AFTER ] [ 'returnDocument' => MongoDB\Operation\FindOneAndReplace::RETURN_DOCUMENT_AFTER ]
); );
var_dump($replacedRestaurant) var_dump($replacedRestaurant);
The output would then resemble:: The output would then resemble::
object(stdClass)#14 (6) { object(MongoDB\Model\BSONDocument)#18 (1) {
["_id"]=> ["storage":"ArrayObject":private]=>
object(MongoDB\BSON\ObjectID)#11 (1) { array(6) {
["oid"]=> ["_id"]=>
string(24) "576023c7b02fa9281da4139e" object(MongoDB\BSON\ObjectID)#11 (1) {
} ["oid"]=>
["borough"]=> string(24) "594d5ef380a846852a4b5837"
string(13) "Staten Island" }
["cuisine"]=> ["Borough"]=>
string(7) "Italian" string(13) "Staten Island"
["grades"]=> ["cuisine"]=>
array(0) { string(7) "Italian"
["grades"]=>
object(MongoDB\Model\BSONArray)#17 (1) {
["storage":"ArrayObject":private]=>
array(0) {
}
}
["name"]=>
string(22) "Staten Island Pastaria"
["restaurant_id"]=>
string(9) "999999999"
} }
["name"]=>
string(22) "Staten Island Pastaria"
["restaurant_id"]=>
string(9) "999999999"
} }
See Also See Also
......
...@@ -72,31 +72,40 @@ setting its building number to ``"761"``: ...@@ -72,31 +72,40 @@ setting its building number to ``"761"``:
] ]
); );
var_dump($updatedRestaurant) var_dump($updatedRestaurant);
The output would then resemble:: The output would then resemble::
object(stdClass)#16 (2) { object(MongoDB\Model\BSONDocument)#20 (1) {
["_id"]=> ["storage":"ArrayObject":private]=>
object(MongoDB\BSON\ObjectID)#10 (1) { array(2) {
["oid"]=> ["_id"]=>
string(24) "5813a08d29032c6e72d566a7" object(MongoDB\BSON\ObjectID)#12 (1) {
} ["oid"]=>
["address"]=> string(24) "594d5ef280a846852a4b3dee"
object(stdClass)#15 (4) { }
["building"]=> ["address"]=>
string(3) "761" object(MongoDB\Model\BSONDocument)#19 (1) {
["coord"]=> ["storage":"ArrayObject":private]=>
array(2) { array(4) {
[0]=> ["building"]=>
float(-73.9925306) string(3) "761"
[1]=> ["coord"]=>
float(40.7309346) object(MongoDB\Model\BSONArray)#18 (1) {
["storage":"ArrayObject":private]=>
array(2) {
[0]=>
float(-73.9925306)
[1]=>
float(40.7309346)
}
}
["street"]=>
string(8) "Broadway"
["zipcode"]=>
string(5) "10003"
}
} }
["street"]=>
string(8) "Broadway"
["zipcode"]=>
string(5) "10003"
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment