{"action":"created","issue":{"url":"https://api.github.com/repos/neoxic/lua-mongo/issues/6","repository_url":"https://api.github.com/repos/neoxic/lua-mongo","labels_url":"https://api.github.com/repos/neoxic/lua-mongo/issues/6/labels{/name}","comments_url":"https://api.github.com/repos/neoxic/lua-mongo/issues/6/comments","events_url":"https://api.github.com/repos/neoxic/lua-mongo/issues/6/events","html_url":"https://github.com/neoxic/lua-mongo/issues/6","id":342253061,"node_id":"MDU6SXNzdWUzNDIyNTMwNjE=","number":6,"title":"Trying to retrieve the server date with serverStatus","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":1,"created_at":"2018-07-18T09:43:23Z","updated_at":"2018-07-18T18:47:08Z","closed_at":null,"author_association":"NONE","body":"I am unable to find the syntax that will give me the serverStatus and so the Date of the server.\r\n\r\nI have tried something like \r\n\r\nret = client:command(\"myDb\",' { \"serverStatus' : 1 } ' )\r\n but ret is not a document\r\n\r\nIn the database methods documentation  there is no database:serverStatus() as I would expect\r\n\r\n\r\nThanks a lot for any help"},"comment":{"url":"https://api.github.com/repos/neoxic/lua-mongo/issues/comments/406035325","html_url":"https://github.com/neoxic/lua-mongo/issues/6#issuecomment-406035325","issue_url":"https://api.github.com/repos/neoxic/lua-mongo/issues/6","id":406035325,"node_id":"MDEyOklzc3VlQ29tbWVudDQwNjAzNTMyNQ==","user":{"login":"neoxic","id":958340,"node_id":"MDQ6VXNlcjk1ODM0MA==","avatar_url":"https://avatars0.githubusercontent.com/u/958340?v=4","gravatar_id":"","url":"https://api.github.com/users/neoxic","html_url":"https://github.com/neoxic","followers_url":"https://api.github.com/users/neoxic/followers","following_url":"https://api.github.com/users/neoxic/following{/other_user}","gists_url":"https://api.github.com/users/neoxic/gists{/gist_id}","starred_url":"https://api.github.com/users/neoxic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/neoxic/subscriptions","organizations_url":"https://api.github.com/users/neoxic/orgs","repos_url":"https://api.github.com/users/neoxic/repos","events_url":"https://api.github.com/users/neoxic/events{/privacy}","received_events_url":"https://api.github.com/users/neoxic/received_events","type":"User","site_admin":false},"created_at":"2018-07-18T18:47:08Z","updated_at":"2018-07-18T18:47:08Z","author_association":"OWNER","body":"As it looks you are new to Lua, it is considered good practice in Lua to wrap calls that return errors in `assert()` to generate exception if you are not ready to handle errors manually. The use of local variables is also handy.\r\n\r\nInstead of:\r\n```Lua\r\nlocal res, err = assert(client:command('myDb', 'INVALID JSON'))\r\nif res then\r\n    print(res)\r\nelse\r\n    print('ERROR', err)\r\nend\r\n```\r\nsimply do:\r\n```Lua\r\nlocal res = assert(client:command('myDb', 'INVALID JSON'))\r\nprint(res)\r\n```\r\n"}}
{"actor":{"display_login":"neoxic"}}