Elemmatch with elements on and off

In and array of objects Name element is present at times and not present on different occasions.
I know elemmatch bring only those arrays which have name element.
It works in mongodb compass UI but not working with mongodb node js npm package 3.6

The query $elemMatch is performed by the server so it is called the same way over the same data, the results should be exactly the same.

You will have to share some document and some code so that we can help. There is something you do differently in the node version if is not working compared to Compass.