See second to last input please.
Note: I was using http://try.mongodb.org/
> person = {fullname : \"Derek Litz\"}
{
\"fullname\" : \"Derek Li
I think that's just a bug in try.mongodb.org
. These work for me in my local mongo
shell:
db.people.find({first_name: {$regex: /e/}})
db.people.find({first_name: /e/})
And the documentation says this:
You may use regexes in database query expressions:
db.customers.find( { name : /acme.*corp/i } );
db.customers.find( { name : { $regex : 'acme.*corp', $options: 'i' } } );
[...]
db.customers.find( { name : { $regex : /acme.*corp/i, $nin : ['acmeblahcorp'] } } );
So both string and RegExp literal versions are supported.
It seems, that http://try.mongodb.org/ just doesn't support regular expressions for some reason. Real console is ok.