Add support to query by array of ids.