Gottox / mongoose-cache

Caches Database querys the easy way. This module is currently not developed. Nevertheless, I will apply patches.
MIT License
36 stars 23 forks source link

RegExp not creating a key #10

Open BrandonCopley opened 9 years ago

BrandonCopley commented 9 years ago

If you create a search using the RegExp object, to search by a regular expression the key that gets created doesn't exist because toJSON for RegExp creates a black string. This can be solved by adding this line.

RegExp.prototype.toJSON = RegExp.prototype.toString;

I have done this in my query files, but perhaps this can go in the library as well to help solve why the key doesn't get created if you are searching based on a regular expression.