{"action":"created","issue":{"url":"https://api.github.com/repos/alcaeus/mongo-php-adapter/issues/209","repository_url":"https://api.github.com/repos/alcaeus/mongo-php-adapter","labels_url":"https://api.github.com/repos/alcaeus/mongo-php-adapter/issues/209/labels{/name}","comments_url":"https://api.github.com/repos/alcaeus/mongo-php-adapter/issues/209/comments","events_url":"https://api.github.com/repos/alcaeus/mongo-php-adapter/issues/209/events","html_url":"https://github.com/alcaeus/mongo-php-adapter/issues/209","id":277877726,"number":209,"title":"document to insert contains invalid key: keys cannot contain \".\" for all mongodb >= 1.3","user":{"login":"necromant2005","id":159874,"avatar_url":"https://avatars2.githubusercontent.com/u/159874?v=4","gravatar_id":"","url":"https://api.github.com/users/necromant2005","html_url":"https://github.com/necromant2005","followers_url":"https://api.github.com/users/necromant2005/followers","following_url":"https://api.github.com/users/necromant2005/following{/other_user}","gists_url":"https://api.github.com/users/necromant2005/gists{/gist_id}","starred_url":"https://api.github.com/users/necromant2005/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/necromant2005/subscriptions","organizations_url":"https://api.github.com/users/necromant2005/orgs","repos_url":"https://api.github.com/users/necromant2005/repos","events_url":"https://api.github.com/users/necromant2005/events{/privacy}","received_events_url":"https://api.github.com/users/necromant2005/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2017-11-29T19:29:07Z","updated_at":"2017-11-29T19:38:22Z","closed_at":null,"author_association":"NONE","body":"For mongodb driver higher version 1.3 convertor fails on insert with message \"document to insert contains invalid key: keys cannot contain \".\"\"\r\n\r\nCore of issue in TypeConvertor.php line 160\r\n```\r\n    private static function convertBSONObjectToLegacy(BSON\\Type $value)\r\n    {\r\n        switch (true) {\r\n            case $value instanceof BSON\\ObjectID:\r\n                return new \\MongoId($value);\r\n```\r\n[PHPC-1004] - Rename ObjectID to ObjectId => http://pecl.php.net/package-changelog.php?package=mongodb\r\n\r\nThat's why the correct code:\r\n```\r\n    private static function convertBSONObjectToLegacy(BSON\\Type $value)\r\n    {\r\n        switch (true) {\r\n            // mongo-driver >= 1.3\r\n            case $value instanceof BSON\\ObjectId:\r\n                return new \\MongoId($value);\r\n            // mongo-driver < 1.3\r\n            case $value instanceof BSON\\ObjectID:\r\n                return new \\MongoId($value);\r\n```\r\n\r\nAlso it requires to apply similar fixes to 4 other places."},"comment":{"url":"https://api.github.com/repos/alcaeus/mongo-php-adapter/issues/comments/347972347","html_url":"https://github.com/alcaeus/mongo-php-adapter/issues/209#issuecomment-347972347","issue_url":"https://api.github.com/repos/alcaeus/mongo-php-adapter/issues/209","id":347972347,"user":{"login":"emirb","id":3412241,"avatar_url":"https://avatars1.githubusercontent.com/u/3412241?v=4","gravatar_id":"","url":"https://api.github.com/users/emirb","html_url":"https://github.com/emirb","followers_url":"https://api.github.com/users/emirb/followers","following_url":"https://api.github.com/users/emirb/following{/other_user}","gists_url":"https://api.github.com/users/emirb/gists{/gist_id}","starred_url":"https://api.github.com/users/emirb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/emirb/subscriptions","organizations_url":"https://api.github.com/users/emirb/orgs","repos_url":"https://api.github.com/users/emirb/repos","events_url":"https://api.github.com/users/emirb/events{/privacy}","received_events_url":"https://api.github.com/users/emirb/received_events","type":"User","site_admin":false},"created_at":"2017-11-29T19:38:22Z","updated_at":"2017-11-29T19:38:22Z","author_association":"CONTRIBUTOR","body":"I say this is not related to the adapter but to Mongo PHP extension itself.\r\n\r\nStarting with 1.3.0, [Driver should validate BSON documents before insert and update](https://jira.mongodb.org/browse/PHPC-712): (related PR: https://github.com/mongodb/mongo-php-driver/pull/524)"}}
{"actor":{"display_login":"emirb"}}