{"action":"created","issue":{"url":"https://api.github.com/repos/neoxic/lua-mongo/issues/5","repository_url":"https://api.github.com/repos/neoxic/lua-mongo","labels_url":"https://api.github.com/repos/neoxic/lua-mongo/issues/5/labels{/name}","comments_url":"https://api.github.com/repos/neoxic/lua-mongo/issues/5/comments","events_url":"https://api.github.com/repos/neoxic/lua-mongo/issues/5/events","html_url":"https://github.com/neoxic/lua-mongo/issues/5","id":337527913,"node_id":"MDU6SXNzdWUzMzc1Mjc5MTM=","number":5,"title":"the positional $ operator seems to be not suported","user":{"login":"FBRISSON","id":6514666,"node_id":"MDQ6VXNlcjY1MTQ2NjY=","avatar_url":"https://avatars2.githubusercontent.com/u/6514666?v=4","gravatar_id":"","url":"https://api.github.com/users/FBRISSON","html_url":"https://github.com/FBRISSON","followers_url":"https://api.github.com/users/FBRISSON/followers","following_url":"https://api.github.com/users/FBRISSON/following{/other_user}","gists_url":"https://api.github.com/users/FBRISSON/gists{/gist_id}","starred_url":"https://api.github.com/users/FBRISSON/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/FBRISSON/subscriptions","organizations_url":"https://api.github.com/users/FBRISSON/orgs","repos_url":"https://api.github.com/users/FBRISSON/repos","events_url":"https://api.github.com/users/FBRISSON/events{/privacy}","received_events_url":"https://api.github.com/users/FBRISSON/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-07-02T13:51:07Z","updated_at":"2018-07-05T10:08:24Z","closed_at":null,"author_association":"NONE","body":"We try to use the notation $ to select all the array value in the projection but this notation seems to be not implemented !\r\nthe string is : \r\n````\r\nstr=string.format([[\r\n[\r\n                { \"$match\": \r\n                               {\r\n                                               \"Code_IG\":\"6546544\",\r\n                                               \"POS.freq\":\"474\"\r\n                               }\r\n                } ,\r\n                { \"$projecti\": \r\n                               { \r\n                                               \"clientID\":1,\r\n                                               \"POS.$\":1,\r\n                                               \"_idques\":0 \r\n                               }\r\n                }\r\n]\r\n]])query=mongo.BSON(str)\r\nloop=collection:aggregate(query):value();\r\nif loop then\r\nOP_Display_mongo_list(\"document\",loop);\r\nEnd\r\n```"},"comment":{"url":"https://api.github.com/repos/neoxic/lua-mongo/issues/comments/402673862","html_url":"https://github.com/neoxic/lua-mongo/issues/5#issuecomment-402673862","issue_url":"https://api.github.com/repos/neoxic/lua-mongo/issues/5","id":402673862,"node_id":"MDEyOklzc3VlQ29tbWVudDQwMjY3Mzg2Mg==","user":{"login":"FBRISSON","id":6514666,"node_id":"MDQ6VXNlcjY1MTQ2NjY=","avatar_url":"https://avatars2.githubusercontent.com/u/6514666?v=4","gravatar_id":"","url":"https://api.github.com/users/FBRISSON","html_url":"https://github.com/FBRISSON","followers_url":"https://api.github.com/users/FBRISSON/followers","following_url":"https://api.github.com/users/FBRISSON/following{/other_user}","gists_url":"https://api.github.com/users/FBRISSON/gists{/gist_id}","starred_url":"https://api.github.com/users/FBRISSON/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/FBRISSON/subscriptions","organizations_url":"https://api.github.com/users/FBRISSON/orgs","repos_url":"https://api.github.com/users/FBRISSON/repos","events_url":"https://api.github.com/users/FBRISSON/events{/privacy}","received_events_url":"https://api.github.com/users/FBRISSON/received_events","type":"User","site_admin":false},"created_at":"2018-07-05T10:08:24Z","updated_at":"2018-07-05T10:08:24Z","author_association":"NONE","body":"I agree I am not an old expert on mongoDB. \r\nHere the description of what I am trying to do with LUA.\r\n\r\nFirst i'll expose what I do with javascript command on robot3t\r\n\r\nI create a very simple collection with 2 documents\r\n\r\n```\r\ndb.getCollection('test').insert({\r\n name : \"tb1\",\r\n array : [\r\n\t{obj1: 50, obj2 : 80},\r\n\t{obj1: 30, obj2 : 60},\r\n\t{obj1: 20, obj2 : 10},\r\n\t{obj1: 2, obj2 : 1}\r\n\t]\r\n})\r\n\r\ndb.getCollection('test').insert({\r\n name : \"tb2\",\r\n array : [\r\n\t{obj1: 50, obj2 : 80},\r\n\t{obj1: 30, obj2 : 60},\r\n\t{obj1: 20, obj2 : 10},\r\n\t{obj1: 2, obj2 : 1}\r\n\t]\r\n})\r\n```\r\n \r\nnext I do the following find on this collection, with a projection including the $ positionnal\r\n\r\n`db.getCollection('test').find({name:\"tb1\",\"array.obj1\":50},{\"array.$\":1})\r\n`\r\nI got this answer\r\n\r\n```\r\n{\r\n    \"_id\" : ObjectId(\"5b3de9584f19d8c35e17602b\"),\r\n    \"array\" : [ \r\n        {\r\n            \"obj1\" : 50.0,\r\n            \"obj2\" : 80.0\r\n        }\r\n    ]\r\n}\r\n\r\n```\r\n\r\nexactly what I want.\r\n\r\nIf I try to do something similar with lua\r\n\r\n```\r\nquery = '{\"name\":\"tb1\",\"array.obj1\":50},{\"array.$\":1})'\r\nqueryBSON = mongo.BSON(query)\r\nfield = sites:findOne(queryBSON):value()\r\n```\r\nI got the error : Got parse error at \")\", position 44: \"SPECIAL_EXPECTED\"\r\n\r\nis there a way to use this positional $ in LUA ?\r\n"}}
{"actor":{"display_login":"FBRISSON"}}