Here is my data structure.
[{
\"name\": \"David\",
\"lastname\": \"\",
},
{
\"name\": \"Angela\"
}]
\"lastname\" is sometimes present and
Facing this problem I thought in another solution:
db.collection.find({"lastname": {"$gte": " "}})
With this I could get only the not empty strings, also ignoring null and not existent field, because any printable value (ASCII) has a greater value than space (32).
https://en.wikipedia.org/wiki/ASCII