Este es el comportamiento esperado. Simplemente puede hacer esto usando la "dot notation" y el $exists
operador
db.hello.find({ 'hobbies.0': { '$exists': true } } )
Otra forma de hacerlo es mediante la agregación y $isArray
operador disponible en MongoDB 3.2. Pero esto es menos eficiente porque $redact
hace un escaneo de colección.
db.hello.aggregate([
{ "$redact": {
"$cond": [
{ $isArray: "$hobbies" },
"$$KEEP",
"$$PRUNE"
]
}}
])