Suppose my document looks like this
{
"_id": 2,
"Name": "Abcd",
"Connected": [1,3]
}
Now, I want to retrieve the array [1,3] via the _id or Name. The purpose is to save this array into a JavaScript array.
Hence I tried using db.myCollection.find({"_id":2},{"Connected":1}) but it return a document again moreover with _id still there like this
{ "_id" : 2, "Connected" : [ 1, 3 ] }
How can I retrieve only that array?