{"action":"created","issue":{"url":"https://api.github.com/repos/mongodb-js/mongodb-core/issues/301","repository_url":"https://api.github.com/repos/mongodb-js/mongodb-core","labels_url":"https://api.github.com/repos/mongodb-js/mongodb-core/issues/301/labels{/name}","comments_url":"https://api.github.com/repos/mongodb-js/mongodb-core/issues/301/comments","events_url":"https://api.github.com/repos/mongodb-js/mongodb-core/issues/301/events","html_url":"https://github.com/mongodb-js/mongodb-core/issues/301","id":317773745,"number":301,"title":"Ability for collection to map ALL documents for every method in one call.","user":{"login":"j","id":589410,"avatar_url":"https://avatars2.githubusercontent.com/u/589410?v=4","gravatar_id":"","url":"https://api.github.com/users/j","html_url":"https://github.com/j","followers_url":"https://api.github.com/users/j/followers","following_url":"https://api.github.com/users/j/following{/other_user}","gists_url":"https://api.github.com/users/j/gists{/gist_id}","starred_url":"https://api.github.com/users/j/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/j/subscriptions","organizations_url":"https://api.github.com/users/j/orgs","repos_url":"https://api.github.com/users/j/repos","events_url":"https://api.github.com/users/j/events{/privacy}","received_events_url":"https://api.github.com/users/j/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2018-04-25T20:03:01Z","updated_at":"2018-04-26T20:11:09Z","closed_at":null,"author_association":"NONE","body":"I'm creating a library to map plain document objects to classes I want to refrain from having to create my own collection wrapper.\r\n\r\nI.E.)\r\n\r\n```typescript\r\nimport { documentToClass } from './mapper';\r\n\r\n@Document()\r\nclass User {\r\n    @Field()\r\n    firstName: string;\r\n\r\n    @Field()\r\n    lastName: string;\r\n}\r\n\r\nconst collection = db.collection('users', {\r\n    map: (doc: any): User {\r\n        return documentToClass(User, doc);\r\n    }\r\n});\r\n\r\n// collection.find() // internally cursor sets map to above\r\n// collection.findOne() // returns User\r\n// collection.updateOne() // returns User\r\n// collection.findOneAndUpdate() // returns User\r\n// .... etc, etc... anything that returns a document(s), gets mapped to User | User[]\r\n```\r\n\r\nIs this possible in the current state?"},"comment":{"url":"https://api.github.com/repos/mongodb-js/mongodb-core/issues/comments/384773766","html_url":"https://github.com/mongodb-js/mongodb-core/issues/301#issuecomment-384773766","issue_url":"https://api.github.com/repos/mongodb-js/mongodb-core/issues/301","id":384773766,"user":{"login":"daprahamian","id":7957497,"avatar_url":"https://avatars3.githubusercontent.com/u/7957497?v=4","gravatar_id":"","url":"https://api.github.com/users/daprahamian","html_url":"https://github.com/daprahamian","followers_url":"https://api.github.com/users/daprahamian/followers","following_url":"https://api.github.com/users/daprahamian/following{/other_user}","gists_url":"https://api.github.com/users/daprahamian/gists{/gist_id}","starred_url":"https://api.github.com/users/daprahamian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/daprahamian/subscriptions","organizations_url":"https://api.github.com/users/daprahamian/orgs","repos_url":"https://api.github.com/users/daprahamian/repos","events_url":"https://api.github.com/users/daprahamian/events{/privacy}","received_events_url":"https://api.github.com/users/daprahamian/received_events","type":"User","site_admin":false},"created_at":"2018-04-26T20:11:09Z","updated_at":"2018-04-26T20:11:09Z","author_association":"CONTRIBUTOR","body":"In that case, could you please file a JIRA ticket [here](https://jira.mongodb.org/browse/NODE) with your feature request?"}}
{"actor":{"display_login":"daprahamian"}}