Analogue for "doesNotExist" when using "match" aggregation stage

Have the pipeline where I want to match objects that have not values for field deletedAt:

match: {
  ...,
  deletedAt: ...,
}

What the operator I need to insert? I tried:
deletedAt: { $exists: false }
That is work the same as { $exists: true } - find object where value for this field settled.

Also unsuccessful attempts:
deletedAt: null
deletedAt: { $eq: null }
deletedAt: { $eq: undefined }

deletedAt: { $exists: false } and deletedAt: { $eq: null } should both work. Would you mind to share the query and the results that you have?

Thank you, I’ll try once again. Just need to know the right operator.

I have three objects, two of them has value in deletedAt field (Date).

const pipeline = [
	{
		match: {
			status: statuses.checked,
			promotion: { $eq: `Promotion$${promotionId}` },
			// deletedAt: { $exists: false },
			// deletedAt: { $exists: true },
			// deletedAt: { $eq: null },
		}
	},
	{ group: { objectId: null, averageRating: { $avg: '$rating' }, reviewsQty: { $sum: 1 } } },
];
const ratingResult = await PromotionReview.getQuery().aggregate(pipeline, { useMasterKey: true });

has output:
ratingResult = [ { averageRating: 3.3333333333333335, reviewsQty: 3, objectId: null } ]

If uncomment deletedAt: { $exists: false } or deletedAt: { $exists: true }
I’ll get the same output:
ratingResult = [ { averageRating: 3, reviewsQty: 2, objectId: null } ]

If uncomment deletedAt: { $eq: null }
I’ll get an empty result:
ratingResult = []

parse-server: 3.6.0.

Could you comment the group stage and share the results for these scenarios?

Didn’t shure that understand you. I have collection with three objects(reviews) like:

rating     deletedAt
4          (undefined)
2          2021-06-21T16:05:39.465Z
4          2021-06-22T17:56:08.765Z

I need to get average rating and reviews quantity for reviews which are not deleted (have not deletedAt value). Results for such input data written in my previous comment.

parse-server replacement with the latest version had no effect.

Traditional query

const reviewQuery = PromotionReview.getQuery()
	.equalTo('promotion', Promotion.createWithoutData(promotionId))
	.equalTo('status', statuses.checked)
	.doesNotExist('deletedAt');

working correctly.

Also I tried to hack this with deletedAt: { $lt(gt): someDate } but without success, such a feeling that records with no value in deletedAt field just dropped when comparing (they behave nor like new Date(0) nor new Date()).

Raw pipeline for mongo working fine:

[
	{
		$match: {
			status: statuses.checked,
			_p_promotion: { $eq: `Promotion$${promotionId}` },
			deletedAt: { $exists: false },
		}
	},
	{ $group: { _id: null, averageRating: { $avg: '$rating' }, reviewsQty: { $sum: 1 } } },
];

I’m not sure if that’s the problem, but can you try with _p_promotion instead of promotion via parse?

It is not crashing but still show incorrect result.

I going stay with raw mongo query, so we can leave this topic. But if you interested with this question I will help you to continue research.