I just merged the feature/query branch into master in the couchbase-lite-ios repo. This means that if you build the master branch you'll have some cool new features for your CBLQueries:
• Sorting by criteria other than the key order (using NSSortDescriptor)
• Filtering the result set (using NSPredicate)
• String or array prefix matching, to find things like "keys starting with 'foo'" or "array keys whose first item is 2014".
• inclusiveEnd and inclusiveStart properties (which default to YES but can be set to NO.)
There's a
wiki page that describes these in more detail.
These features are planned for the cross-platform public API, but they haven't been through API review yet, so the names might change slightly in the near future. They'll be in the next iOS release (1.0.3?) and hopefully on the other platforms too.
And if you're
really into bleeding-edge stuff, there's an experimental class called
CBLQueryPlanner that provides a higher-level API for defining views and queries; it's somewhat like Core Data's NSFetchRequest. You can see some examples in its
unit tests. This is not close to release, though; it's more of a technology demonstration that we're still figuring out how to integrate with the view engine and public API. If you want to try it out, you'll need to add the source file and header to your app project and build them yourself.
—Jens