{"action":"opened","issue":{"url":"https://api.github.com/repos/couchbase/couchbase-lite-ios/issues/921","labels_url":"https://api.github.com/repos/couchbase/couchbase-lite-ios/issues/921/labels{/name}","comments_url":"https://api.github.com/repos/couchbase/couchbase-lite-ios/issues/921/comments","events_url":"https://api.github.com/repos/couchbase/couchbase-lite-ios/issues/921/events","html_url":"https://github.com/couchbase/couchbase-lite-ios/issues/921","id":107661297,"number":921,"title":"CBLQueryBuilder: Sorted property disappears from _valueTemplate (select)","user":{"login":"24601","id":1157207,"avatar_url":"https://avatars.githubusercontent.com/u/1157207?v=3","gravatar_id":"","url":"https://api.github.com/users/24601","html_url":"https://github.com/24601","followers_url":"https://api.github.com/users/24601/followers","following_url":"https://api.github.com/users/24601/following{/other_user}","gists_url":"https://api.github.com/users/24601/gists{/gist_id}","starred_url":"https://api.github.com/users/24601/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/24601/subscriptions","organizations_url":"https://api.github.com/users/24601/orgs","repos_url":"https://api.github.com/users/24601/repos","events_url":"https://api.github.com/users/24601/events{/privacy}","received_events_url":"https://api.github.com/users/24601/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-09-22T07:42:26Z","updated_at":"2015-09-22T07:42:26Z","closed_at":null,"body":"Assuming a CBLQueryBuilder like so:\r\n\r\nself.vtEdgeQueryBuilder = try CBLQueryBuilder.init(database: self.cblDatabase, select: [\"_id\",\"label\",\"tags\",\"leftId\",\"rightId\",\"matchData\",\"data\",\"metaData\",\"displayPriority\"], `where`: \"_id LIKE $PERSONID AND type LIKE 'VTEdge'\", orderBy: [\"-label\"]);\r\n\r\nThe select (_valueTemplate) at runtime does NOT include the \"label\" property, it is simply omitted, resulting in array that is of length 7, not length 8. \r\n\r\nRemoving it from the orderBy restores expected functionality (e.g. it is selected and in the _valueTemplate):\r\n\r\nself.vtEdgeQueryBuilder = try CBLQueryBuilder.init(database: self.cblDatabase, select: [\"_id\",\"label\",\"tags\",\"leftId\",\"rightId\",\"matchData\",\"data\",\"metaData\",\"displayPriority\"], `where`: \"_id LIKE $PERSONID AND type LIKE 'VTEdge'\", orderBy: []);\r\n\r\n\r\nThis previously worked, as recently as July, I've looked at changes since then and can't seem to find anything that would seem to break this except possibly the code changes where keyPredicates are removed from _valueTemplate.\r\n\r\nThis behavior still does not appear to make sense to me in that just because I am sorting on a value does not mean I don't necessarily want it in my _valueTemplate, in fact, it's probably all the more probable I would. "}}