Why doesn't MongoDb store my slashes in this string?
Posted
by
Rob Dudley
on Stack Overflow
See other posts from Stack Overflow
or by Rob Dudley
Published on 2012-07-03T20:40:33Z
Indexed on
2012/07/03
21:15 UTC
Read the original article
Hit count: 256
mongodb
Can anyone tell me why this command doesn't work from the MongoDB shell client:
db.coll.update({'live':true},{$set:{'mask':"\D\D\D\D\D\D\D\D"}},false,true)
but
db.coll.findOne({'id':'someId'})
returns the mask field as:
"mask" : "DDDDDDDD",
Where are the slashes going?
I've tried "double escaping" with \\D and that inserts both slashes:
"mask" : "\\D\\D\\D\\D\\D\\D\\D\\D",
MongoDB shell version: 2.0.6, MongoDB version: 2.0.5, OSX Lion
Thanks
© Stack Overflow or respective owner