Query where "field" == nil

Perhaps to extend the answer I have been looking to the docs on indexing and query performance here and if I understand it right, the value nil is not using indexing and therefore doesNotExist would perform slower on a large number of objects?

I am asking, because I would like to implement “cleaning” cloud job where the objects are older than XY and have a certain field nil. I believe that for the better performance, the version with default value as @uzaysan proposed is more suitable.

Please correct me if I am wrong.

1 Like