@jayson there’s a PR that will be released in the Swift SDK 3.0.0 that may better address your needs. The details are in the link:
Note that for QueryConstraint there are two added counterparts for exist and doesNotExist, isNotNull, and isNull. For Mongo users these constraints yield different results as isNull in your original question will get you your expected results, displayUtil == undefined || displayUtil == null. Using doesNotExist will only get you displayUtil == undefined. This becomes important based on if you set values to undefined or null on your server. If you are using Postgres, this doesn’t matter is much as $exist is treated as NOT NULL and there’s no difference between null or undefined.
I suspect this should also help address any performance issues @lsmilek1 brought up with performance and indexes mentioned in Query where "field" == nil - #6 by lsmilek1 as isNull and isNotNull should allow you take advantage of indexing on MongoDB (I’m guessing). I’m not a Mongo expert, so @Manuel feel free to chime in if my comments about Mongo performance is true or not. I don’t know how the other SDKs handle querying for null (or if they have the feature at all), so I’m not sure how you take advantage of this in Cloud Code, though looking at the JS query constraints may provide some insight:
The Swift SDK will have this available on the main branch shortly and then in 3.0.0 sometime this month. You can point your SPM to the main branch in the mean time.