Mongoose query returning arrays as undefined
<p>I currently have a mongoose model that I am saving multiple IDs as an array.</p>

<pre><code>var map = new Schema ({
    "AdminID" : [{type: mongoose.Schema.Types.ObjectId, required: false }],
    "AdminKeys" : [{type: mongoose.Schema.Types.ObjectId, required: false }]
});
</code></pre>

<p>When I make a query through the mongo shell, I can see that there are some values in the AdminKeys array.</p>

<pre><code>"_id" : ObjectId("584101b5b2483a57256bdf16"),
"AdminID" : [ ],
"AdminKeys" : [
        ObjectId("583b5f0b9a64391584e4b4ad")
]
</code></pre>

<p>However, in my controller, when I try and do</p>

<pre><code>Map.findOne({_id: ObjectId('584101b5b2483a57256bdf16')}, 
{_id : 0, AdminID: 1, AdminKeys: 1 } (err, map) =&gt; {

      if (err) {
        console.log(err);
        return;
      }
      console.log(map);
}
</code></pre>

<p>I am left with undefined array fields and cannot access any of the values within my AdminKeys array.</p>

<pre><code>_doc: 
     { AdminID: undefined,
       AdminKey: undefined },
'$__original_save': [Function],
</code></pre>

<p>If someone would be so kind to help me understand what is going on and a work around, It would be much appreciated.</p>