With firestore, how do I write a query to find documents that have an undefined
field?
For example, here's a firestore collection with two documents:
{
users: { // <- the collection
a: { // <- the document
active: true,
profile: {
first_name: 'Homer',
last_name: 'Simpson',
}
},
b:
active: true
}
}
}
(Here's screenshots from the firestore console): Document 'a' , Document 'b'
Given the above firestore data, I want to do something like this:
firestore().collection('users').where('profile', '==', undefined)
(which is not a valid query for firestore)
How can I write a query to retrieve all documents (users
) where a certain field (profile
) does NOT exist?
Thanks!