Added a 'query' function that returns result of a query in an array. This is based on the 'getAll' function.