LearnBoost/mongoose — pull request #906 by GothAck (2012-05-10 12:08:17+00:00)
Title: Fix casting of RegExp within conditional statement

Currently the following code casts the RegExps to strings if firstName and lastName are defined as strings in the Schema:

`
var kwRe = {$regex: new RegExp(keyword, 'gi')};
query.$or([{firstName: kwRe}, {lastName: kwRe}])
`

This patch stops casting RegExps when the query is cast