Return records which contains a specific field

I’ve many records in my database but some of them have a specific field and other don’t have, I want to fetch the records which contains that specific field, no matter the value of that field.
e.g
{ "firstName": "awaisiqbal", "lastName": "iqbal", "email": "aw@is", "phone": 31427196, "fcmToken": "cgZuRSnNS22aM36lFHmPZ6" }

my records are similar to above, except some have fcmToken while other don’t have, so I want to get all the document that have this field.

Solved by this
{fcmToken:{$exists:true}}

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.