I have a map function in swift that emits an array of value in the format below:
[gggggg, yyyy, DDD, HH, mm, ss]
where g is a unique number that is padded with zeros, y is year, D is day of year (0-364), H is hour (0-23), m in minute, and s is second. All are strings and padded appropriately. A sample output is
[000001, 2015, 156, 05, 19, 20]
[000023, 2030, 004, 22, 40, 46]
[000234, 2200, 286, 04, 00, 00]
The idea is that I want to query as to get all documents for a given unique value that is sorted by date. However, despite reading countless articles and other forums, I have yet to get a query that returns a result using startkey and endkey. A query with exact keys does work.
I have tried
query.startKey = [“000000”,“0000”, “000”, “00”, “00”, “00”]
query.endKey = [“999999”, “9999”, “365”, “23”, “59”, “59”]
just to see if it works, but this still returns 0 results ( I have about 20 in my database).
Using
query.startKey = [“000001”,“2000”, “000”, “00”, “00”, “00”]
query.endKey = [“000001”, “2300”, “365”, “23”, “59”, “59”]
Also returns nothing, despite having at least 10 documents that match the unique key “000001”
For reference, I am printing out my compound keys from the map function so that I know that my formatting is correct.
The parameters I have put on my query are
query.descending = true
query.mapOnly = true (have tried without specifying this as well)
query.inclusiveEnd = true/false/not included
Being that this is fed into a CBLUITableSource, I have tried running the query before and after I create the live query.
If I do not specify the start key or end key, all documents are returned from the map function.
Any help would be appreciated. I know this is a common topic but for some reason I can’t get it to work. Thank you for your time.