typicaljoe/taffydb — pull request #28 by japettyjohn (2013-01-04 08:03:28+00:00)
Title: Caching bug fix

Hi 'Joe',

I've made a few changes. One was to had a 'contains' comparator for fields containing arrays, e.g.:

{
name: 'James'
types: ['x','y','z']
}

then compared with

taffyDB({types:{contains:'y'}})

The other thing is a broken caching key with regex:

taffyDB({name:{regex:/James/}}).count() === 1;
taffyDB({name:{regex:/Anything else at this point/}}).count() === 1;
taffyDB({name:{regex:/Will always work/}}).count() === 1;

Because:
JSON.stringify(/Anything/) === JSON.stringify(/Everything/) &&
JSON.stringify(/Everything/) === '{}'