Views in the Sync Gateway?

You can create design documents with custom views via the REST API.
See this thread for the curl commands to create the view and query it.

Currently, Sync Gateway returns all documents when querying custom views on the admin port.
There is an open issue on github to add this functionality on the public, user facing port (4984) which would filter the views to the documents visible to a specific user.

The built-in _all_docs view already returns filtered results.