st78
st78

Reputation: 8316

Search by character code in mongoDB

How can I find documents which contains character 0x1F?

{"Description":new RegExp("▼")}

returns 0 results. Also, search for new line character returns 0 results, despite fact that it exists in description of some documents:

{"Description":new RegExp("♪")}

Upvotes: 0

Views: 165

Answers (1)

Derick
Derick

Reputation: 36774

On the Mongo shell, you can do:

db.char.find( { "Description": /\x1F/ } );

Upvotes: 1

Related Questions