{"action":"created","issue":{"url":"https://api.github.com/repos/feathersjs/feathers/issues/1085","repository_url":"https://api.github.com/repos/feathersjs/feathers","labels_url":"https://api.github.com/repos/feathersjs/feathers/issues/1085/labels{/name}","comments_url":"https://api.github.com/repos/feathersjs/feathers/issues/1085/comments","events_url":"https://api.github.com/repos/feathersjs/feathers/issues/1085/events","html_url":"https://github.com/feathersjs/feathers/issues/1085","id":379404456,"node_id":"MDU6SXNzdWUzNzk0MDQ0NTY=","number":1085,"title":"filterQuery of @feathersjs/commons is not working if we have ObjectID in query","user":{"login":"dharmadurai","id":16523837,"node_id":"MDQ6VXNlcjE2NTIzODM3","avatar_url":"https://avatars0.githubusercontent.com/u/16523837?v=4","gravatar_id":"","url":"https://api.github.com/users/dharmadurai","html_url":"https://github.com/dharmadurai","followers_url":"https://api.github.com/users/dharmadurai/followers","following_url":"https://api.github.com/users/dharmadurai/following{/other_user}","gists_url":"https://api.github.com/users/dharmadurai/gists{/gist_id}","starred_url":"https://api.github.com/users/dharmadurai/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dharmadurai/subscriptions","organizations_url":"https://api.github.com/users/dharmadurai/orgs","repos_url":"https://api.github.com/users/dharmadurai/repos","events_url":"https://api.github.com/users/dharmadurai/events{/privacy}","received_events_url":"https://api.github.com/users/dharmadurai/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-11-10T08:45:59Z","updated_at":"2018-11-15T17:21:56Z","closed_at":null,"author_association":"NONE","body":"I am using @feathersjs/commons and the following line\r\nconst { filters, query } = filterQuery(params.query || {});\r\n\r\nIn params.query i have teamId and userId, Before this line I am converting to new ObjectID().\r\nDue to the filterQuery, userId is converted to different object. So mongo db query returning error.\r\n\r\n### Before filterQuery\r\n```\r\nquery {\r\n  \"userId\": \"5be67f437c1387311f7b37cd\",\r\n  \"teamId\": \"5be67f437c1387311f7b37ce\"\r\n}\r\n```\r\n### After filterQuery\r\n```\r\nquery {\r\n  \"userId\": {\r\n    \"_bsontype\": \"ObjectID\",\r\n    \"id\": {\r\n      \"0\": 91,\r\n      \"1\": 230,\r\n      \"2\": 127,\r\n      \"3\": 67,\r\n      \"4\": 124,\r\n      \"5\": 19,\r\n      \"6\": 135,\r\n      \"7\": 49,\r\n      \"8\": 31,\r\n      \"9\": 123,\r\n      \"10\": 55,\r\n      \"11\": 205\r\n    }\r\n  },\r\n  \"teamId\": {\r\n    \"_bsontype\": \"ObjectID\",\r\n    \"id\": {\r\n      \"0\": 91,\r\n      \"1\": 230,\r\n      \"2\": 127,\r\n      \"3\": 67,\r\n      \"4\": 124,\r\n      \"5\": 19,\r\n      \"6\": 135,\r\n      \"7\": 49,\r\n      \"8\": 31,\r\n      \"9\": 123,\r\n      \"10\": 55,\r\n      \"11\": 206\r\n    }\r\n  }\r\n}\r\n```\r\n### Error in mongodb query result\r\n```\r\nobject [{\"_bsontype\":\"ObjectID\",\"id\":{\"0\":91,\"1\":230,\"2\":127,\"3\":67,\"4\":124,\"5\":19,\"6\":135,\"7\":49,\"8\":31,\"9\":123,\"10\":55,\"11\":205}}] is not a valid ObjectId\r\n    at serializeObjectId (opt/modules/rodeo2018/node_modules/bson/lib/bson/parser/serializer.js:288)\r\n    at serializeInto (opt/modules/rodeo2018/node_modules/bson/lib/bson/parser/serializer.js:932)\r\n    at serializeObject (opt/modules/rodeo2018/node_modules/bson/lib/bson/parser/serializer.js:348)\r\n    at serializeInto (opt/modules/rodeo2018/node_modules/bson/lib/bson/parser/serializer.js:938)\r\n    at BSON.serialize (opt/modules/rodeo2018/node_modules/bson/lib/bson/bson.js:63)\r\n    at Query.toBin (opt/modules/rodeo2018/node_modules/mongodb-core/lib/connection/commands.js:146)\r\n    at serializeCommands (opt/modules/rodeo2018/node_modules/mongodb-core/lib/connection/pool.js:1045)\r\n    at Pool.write (opt/modules/rodeo2018/node_modules/mongodb-core/lib/connection/pool.js:1261)\r\n    at Server.command (opt/modules/rodeo2018/node_modules/mongodb-core/lib/topologies/server.js:784)\r\n    at Server.command (opt/modules/rodeo2018/node_modules/mongodb/lib/topologies/topology_base.js:316)\r\n    at executeCommand (opt/modules/rodeo2018/node_modules/mongodb/lib/operations/db_ops.js:493)\r\n    at count (opt/modules/rodeo2018/node_modules/mongodb/lib/operations/collection_ops.js:191)\r\n    at opt/modules/rodeo2018/node_modules/mongodb/lib/utils.js:437\r\n    at new Promise (<anonymous>)\r\n    at executeOperation (opt/modules/rodeo2018/node_modules/mongodb/lib/utils.js:432)\r\n    at Collection.<anonymous> (opt/modules/rodeo2018/node_modules/mongodb/lib/collection.js:1375)\r\n```\r\n\r\nI am using latest package installed today. Is any other lower version i should use ? Can you respond asap"},"comment":{"url":"https://api.github.com/repos/feathersjs/feathers/issues/comments/439120259","html_url":"https://github.com/feathersjs/feathers/issues/1085#issuecomment-439120259","issue_url":"https://api.github.com/repos/feathersjs/feathers/issues/1085","id":439120259,"node_id":"MDEyOklzc3VlQ29tbWVudDQzOTEyMDI1OQ==","user":{"login":"daffl","id":338316,"node_id":"MDQ6VXNlcjMzODMxNg==","avatar_url":"https://avatars0.githubusercontent.com/u/338316?v=4","gravatar_id":"","url":"https://api.github.com/users/daffl","html_url":"https://github.com/daffl","followers_url":"https://api.github.com/users/daffl/followers","following_url":"https://api.github.com/users/daffl/following{/other_user}","gists_url":"https://api.github.com/users/daffl/gists{/gist_id}","starred_url":"https://api.github.com/users/daffl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/daffl/subscriptions","organizations_url":"https://api.github.com/users/daffl/orgs","repos_url":"https://api.github.com/users/daffl/repos","events_url":"https://api.github.com/users/daffl/events{/privacy}","received_events_url":"https://api.github.com/users/daffl/received_events","type":"User","site_admin":false},"created_at":"2018-11-15T17:21:56Z","updated_at":"2018-11-15T17:21:56Z","author_association":"MEMBER","body":"When and where is this happening? Most database adapters have not yet been updated to use that version of `@feathersjs/commons`."}}
{"actor":{"display_login":"daffl"}}