Last active
August 29, 2015 14:28
-
-
Save chrisguitarguy/f83cf02124181d717438 to your computer and use it in GitHub Desktop.
Just some MongoDB PHP API Weirdness I guess?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| $mongo = new \MongoClient(); | |
| $col = $mongo->testDb->testCollection; | |
| $col->drop(); | |
| $col->insert(['test' => 'one']); | |
| // works perfectly | |
| var_dump(iterator_to_array($col->find([ | |
| 'test' => 'one', | |
| ], ['test']))); | |
| // requires fields to be `fieldName => true/false` | |
| var_dump($col->findAndModify([ | |
| 'test' => 'one', | |
| ], [ | |
| '$set' => ['test' => 'two'], | |
| ], ['test' => true], [ | |
| 'upsert' => true, | |
| 'new' => true, | |
| ])); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment