What about some list operation functions? like "[one of the things in this list] is a member of [the things in that list]"?
One of the use cases I often see, and have wanted myself is per document user authorization. Without trying to solve everything all at once, being able to efficiently compare membership multiple lists as a filter would be generically useful. Imagine the _users document contained "authTokens" which is simply a list of strings or numbers that the user is authorized as. These authTokens would most likely represent group names that the user belonged to. The list is flat, not hierarchical. If a user is a member of Group 1, and Group 1 is a member of Group 2; then the authTokens list will have both Group 1 and Group 2 in the list. (databasename_authTokens would contain a database specific list of tokens.) How the list gets assigned is outside the scope here (let's just say there's either a management app or the app itself has to do it). Each doc then has an "_readers" list. It represents the list of authTokens that have been given permission to read the document. The filter query could then be something like "intersect(user.authTokens, doc._readers).length > 0" the intersect command returns a list of overlapping list members; the length of that list being the count of members in common; and being greater than 0; means there was at least one match. Other functions would be: union: A list that is the combination of all lists with duplicates removed filter: A list made from the first list, with all members of the other lists removed intersect: A list of only things in all lists outersect: A list of only things that exist on one of the lists member: A boolean where the length of the intersect > 0 (this would be better used in the example above)