Server errors in log due to rules.json

Today I received a support request from a user of my web site saying they couldn’t log in. When I investigated I saw a sudden spike in errors in my Atlas App Services log file looking like this:

InternalServerError Error
Error:
error executing match expression: $and/$or/$nor needs an array

And as far as I could see my web site was unusable. I traced the error to an entry in a rules.json file looking like this:

		{
	        "name": "system_group",
			"apply_when": { "%and": [ { "%%user.custom_data.group_owner_id": { "%exists": true } }, 
						{ "%%root.owner_id": "%%user.custom_data.group_owner_id" } ] },
	        "read": true,
	        "write": false,
	        "insert": false,
	        "delete": false,
	        "search": true,
			"additional_fields": {}
		},

This had been in the code for many months unchanged. However, we decided to remove these entries from the site (which disabled certain functionality) and the errors went away and the web site came back up. I raised a support request and it seems that there was a MongoDb release today that caused an issue. Has anyone else seen anything similar. I’m curious to the exact impact of this as we have other rules that were not impacted by the issue.

I see from MongoDB support that the issue is now fixed (several hours ago). We have now rolled back our workaround and can confirm the web site is up and running as normal. Thanks to all at MongoDb for such a rapid response.