regex - Is there a way to temporarily change an int to a string in mongodb db.find? -
in collection have there field may numbers or strings depending on trying categorize. each number measurement plus id measurement 400 id .01 put in 400.01. not have ability change database @ need change these doubles string can perform regex search on them.
for example asked find ids 400 measurements. need collect numbers 400.01, 400.05, etc.
so far have
db.collection.find{field:{$regex:/^400/m}}
which works not doubles , tried:
db.collection.find{{$set:{dx:dx.tostring()}:{$regex:/^400/m}}
but doesn't work.
example:
{"date":99-99-9999,"dx":400.1} {"date":99-99-9999,"dx":"400.056"} {"date":00-00-0000,"dx":"5n.05"} {"date":11-11-1111,"dx":400.03}
Comments
Post a Comment