{"action":"opened","issue":{"url":"https://api.github.com/repos/mongodb/mongo-php-library/issues/256","repository_url":"https://api.github.com/repos/mongodb/mongo-php-library","labels_url":"https://api.github.com/repos/mongodb/mongo-php-library/issues/256/labels{/name}","comments_url":"https://api.github.com/repos/mongodb/mongo-php-library/issues/256/comments","events_url":"https://api.github.com/repos/mongodb/mongo-php-library/issues/256/events","html_url":"https://github.com/mongodb/mongo-php-library/issues/256","id":179819327,"number":256,"title":"Collection::findOneAndUpdate not respecting typeMap set in client","user":{"login":"rikkiloades","id":753329,"avatar_url":"https://avatars.githubusercontent.com/u/753329?v=3","gravatar_id":"","url":"https://api.github.com/users/rikkiloades","html_url":"https://github.com/rikkiloades","followers_url":"https://api.github.com/users/rikkiloades/followers","following_url":"https://api.github.com/users/rikkiloades/following{/other_user}","gists_url":"https://api.github.com/users/rikkiloades/gists{/gist_id}","starred_url":"https://api.github.com/users/rikkiloades/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rikkiloades/subscriptions","organizations_url":"https://api.github.com/users/rikkiloades/orgs","repos_url":"https://api.github.com/users/rikkiloades/repos","events_url":"https://api.github.com/users/rikkiloades/events{/privacy}","received_events_url":"https://api.github.com/users/rikkiloades/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-09-28T16:18:21Z","updated_at":"2016-09-28T16:18:21Z","closed_at":null,"body":"I have set a typeMap in the global client:\r\n\r\n```\r\n$db = 'mydb';\r\n$collection = 'mycollection';\r\n$uriOptions = [];\r\n$driverOptions = ['typeMap' => ['root' => 'array', 'document' => 'array', 'array' => 'array']];\r\n$mongoDb = new \\MongoDB\\Client($this->connectionString, $uriOptions, $driverOptions);\r\n```\r\n\r\nThen when i call `findOneAndUpdate`:\r\n\r\n```\r\n$mongoDb->selectDatabase($db)->selectCollection($collection)->findOneAndUpdate($criteria, $updates, $options);\r\n```\r\n\r\nI get back a `stdClass` object at the root level. I was expecting an array. The old pecl/mongo driver used to return an `array` and the typeMap is not being respected to allow me to get it back just like the old driver.\r\n\r\nI appreciate and understand the move to BSONDocument and BSONArray and if this were a new project I would not be setting that typemap and taking advantage of the new BSON serialisation behaviours. However there is a fairly large codebase that is sitting on top of the old behaviour and relying on it and updating all that code to use the new BSON behaviour is unpractical."}}
{"actor":{"display_login":"rikkiloades"}}