Create a minimal query interface that allows clients to query messages and groups by their metadata.
This could be loosely modelled on MongoDB's query interface:
- Use the builder pattern to construct queries
- Optionally supply a criteria object: this is a Metadata object populated with keys and optionally values to match
- Optionally supply a projection object: this is a Metadata object populated with keys to retrieve
- Optionally count results instead of returning them