{"action":"created","issue":{"url":"https://api.github.com/repos/bchavez/RethinkDb.Driver/issues/6","labels_url":"https://api.github.com/repos/bchavez/RethinkDb.Driver/issues/6/labels{/name}","comments_url":"https://api.github.com/repos/bchavez/RethinkDb.Driver/issues/6/comments","events_url":"https://api.github.com/repos/bchavez/RethinkDb.Driver/issues/6/events","html_url":"https://github.com/bchavez/RethinkDb.Driver/issues/6","id":112878025,"number":6,"title":"Syntax of specifying index with getAll()","user":{"login":"fiLLLip","id":1264369,"avatar_url":"https://avatars.githubusercontent.com/u/1264369?v=3","gravatar_id":"","url":"https://api.github.com/users/fiLLLip","html_url":"https://github.com/fiLLLip","followers_url":"https://api.github.com/users/fiLLLip/followers","following_url":"https://api.github.com/users/fiLLLip/following{/other_user}","gists_url":"https://api.github.com/users/fiLLLip/gists{/gist_id}","starred_url":"https://api.github.com/users/fiLLLip/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fiLLLip/subscriptions","organizations_url":"https://api.github.com/users/fiLLLip/orgs","repos_url":"https://api.github.com/users/fiLLLip/repos","events_url":"https://api.github.com/users/fiLLLip/events{/privacy}","received_events_url":"https://api.github.com/users/fiLLLip/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":9,"created_at":"2015-10-22T19:51:57Z","updated_at":"2015-10-22T20:49:55Z","closed_at":"2015-10-22T20:47:42Z","body":"While waiting for the [cursor troubles](https://github.com/bchavez/RethinkDb.Driver/issues/4) to get implemented, I used a workaround to get results with getAll at all:\r\n```\r\n            var result = (IEnumerator<object>)_rethinkDb.db(dbName).table(tableName).getAll(id1, id2, id3).run(_connection);\r\n            List<Foo> all = new List<Foo>();\r\n            try\r\n            {\r\n                while (result.MoveNext())\r\n                {\r\n                    all.Add(((JObject)result.Current).ToObject<Foo>());\r\n                }\r\n            }\r\n            catch (InvalidOperationException)\r\n            {\r\n                // Swallow the error\r\n            }\r\n            return all;\r\n```\r\nThis returns three objects in a list. If I want to query a secondary index I have tried to change the ```var result``` to the following with no results:\r\n```\r\nvar result = (IEnumerator<object>)_rethinkDb.db(dbName).table(tableName).getAll(value, $\"{{index={nameof(Foo.Value)}}}\").run(_connection);\r\n```\r\nAnd if I try to change it to the following:\r\n```\r\nvar result = (IEnumerator<object>)_rethinkDb.db(dbName).table(tableName).getAll(value, new {index=nameof(Foo.Value)}).run(_connection);\r\n```\r\nI get an error:\r\n```\r\nReqlQueryLogicError: Primary keys must be either a number, string, bool, pseudotype or array (got type OBJECT):\r\n{\r\n\"index\":\t\"Url\"\r\n}\r\n```\r\n\r\nHow do I query this in the right way?"},"comment":{"url":"https://api.github.com/repos/bchavez/RethinkDb.Driver/issues/comments/150352192","html_url":"https://github.com/bchavez/RethinkDb.Driver/issues/6#issuecomment-150352192","issue_url":"https://api.github.com/repos/bchavez/RethinkDb.Driver/issues/6","id":150352192,"user":{"login":"bchavez","id":478118,"avatar_url":"https://avatars.githubusercontent.com/u/478118?v=3","gravatar_id":"","url":"https://api.github.com/users/bchavez","html_url":"https://github.com/bchavez","followers_url":"https://api.github.com/users/bchavez/followers","following_url":"https://api.github.com/users/bchavez/following{/other_user}","gists_url":"https://api.github.com/users/bchavez/gists{/gist_id}","starred_url":"https://api.github.com/users/bchavez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bchavez/subscriptions","organizations_url":"https://api.github.com/users/bchavez/orgs","repos_url":"https://api.github.com/users/bchavez/repos","events_url":"https://api.github.com/users/bchavez/events{/privacy}","received_events_url":"https://api.github.com/users/bchavez/received_events","type":"User","site_admin":false},"created_at":"2015-10-22T20:49:55Z","updated_at":"2015-10-22T20:49:55Z","body":"I do have an issue #1 to explore using allow anon types for opt args. I think it would also be pretty cool, and help syntactically, but AFAIK the only way to enumerate properties on Anonymous types is to use reflection (or possibly direct serialization from Newtonsoft). We'd have to investigate the performance bit more IMHO for serializing anonymous type opt args.\r\n\r\nComplexity probably wont be a big issue if we stick to using `.optArg()`. Perhaps, we can additionally support:\r\n\r\n```\r\nCursor<Foo> all = r.db(DbName).table(TableName).getAll(\"a\", \"b\", \"c\")\r\n                .optArg(new {index = \"code_name\", other=\"param\"})\r\n                .run<Foo>(conn);\r\n```\r\n"}}