Query nil and non-existing values

Is there any way to shortcut this query?
It seems to me a lot of verbose to just discard nil/non-existing value that usually from the code perspective it’s basically the same, specially using ORM as MongoId.


should: [
              { equals: { path: 'task_team_id', value: nil } }, # Check for null (nil) value
              { compound: {
                mustNot: [
                  { exists: { path: 'task_team_id' } }
                ]
              } }
            ],
            minimumShouldMatch: 1

Thank you