Rework the datastore query interface.