Is there a way to do a falsey query in firestore. I make a document as is_deleted=true when I delete it, but when it is not deleted the document doesn't have an is_deleted value. But when I do a query in firestore for is_deleted==false, it does not return any document that does not have the is_deleted field, it will return is_deleted=false. Is there a way to return falsey data set? ie: is_deleted=false or is_deleted=undefined?
Asked
Active
Viewed 27 times
0
-
No, you can only query for fields that actually exist on a document. This is the only way an index can work efficiently (there is a near-infinite number of fields that won't exist on your document - how would you scalably and efficiently query for non-existence of any of them?0 – Doug Stevenson Nov 30 '18 at 19:46
-
Hold up a sec... You say *but when it is not deleted the document doesn't have an is_deleted value*, so that means when a document is not deleted the field is_deleted doesn't exist. But then you state you query for *is_deleted==false*. Those statements are conflicting; if you know that your non deleted documents do NOT contain that field, then why query for it? Isn't it just a simple matter of deleted documented have that field set to true and not deleted documents have it set to false? – Jay Dec 01 '18 at 13:16