Tech C**P
15 subscribers
161 photos
9 videos
59 files
304 links
مدرس و برنامه نویس پایتون و لینوکس @alirezastack
Download Telegram
How to find documents with a specific field type?

It may happen to have different field types in a specific field like credit, and some of them are numeric and some of them string. In order to find NumberLong() field types you can use $type:

db.users.find({credit: {$type: "long" }})


If you want to remove those fields, if applicable, use remove instead of find to remove those documents that has wrong types. It is not sensible to do that for users document though, it just gives you the idea.

#mongodb #mongo #type #field_type #remove #find