Query on non empty object field having multiple keys or to check size of object greater than 1

That is not the right query for it.

You have to write an aggregation query and use the $objectToArray aggregation operator to convert the object as an array and then find the length of the array. If the length of the array is greater than 1, then there are more than one field in the object. See the example from the documentation explains how to convert the object to an array.

1 Like