function recordMatchesQuery(record) {
      return Object.keys(query).every(function(property) {
        var test = query[property];
        if (Object.prototype.toString.call(test) === '[object RegExp]') {
          return test.test(record[property]);
        } else {
          return record[property] === test;
        }
      });
    }
In the case where there are relationships, this method is called again
for each relation. Given the relations have references to the main
object, we use allowRecursive to avoid going further into infinite
recursiveness.

Concept from ember-indexdb-adapter