Query empty reference field isEmpty() not working

I’m trying to get records with empty value in a multi-item reference field. In the example below, I’m trying to get students who aren’t assigned to any class.
The following query returns the error below:

let res = await wixData.query(“Students”).include(“classes”).isEmpty(“classes”).find();

Error message: " Cannot read property ‘$hasSome’ of null "

It seems like the issue that you are experiencing is not related to the line of code that you have provided. Please make sure to send a part of a code that contains the hasSome() function, as the error is related to it.

For more information about possible issues please check out this reference: https://www.wix.com/corvid/reference/wix-data.WixDataQuery.html#hasSome