So I have a field called \'city\' in my results...the results are corrupted, some times it\'s an actual name, sometimes it\'s a number. The following code displays all the recor
With the mongodb 4.4 (upcoming), You can use $isNumber pipeline operator to check whether the expression is integer or other BSON type.
db.zips.find({ "$expr": { "$anyElementTrue": { "$isNumber": "$city" }}})
$isNumber will return true or false corrsoponding to the expression and $anyElementTrue will return the $match
ed documents.