E
E
Egor Zhivagin2017-03-21 16:52:28
JavaScript
Egor Zhivagin, 2017-03-21 16:52:28

How to count the number of elements in an array in Monge?

Let's say I have such an object in the collection:

{
    "_id" : 123,
    "name" : "Eclipse",
    "arrayOne" : [ 
        {
            "name" : "nameArray",
            "arrayTwo" : [ 
                {
                    "items" : [ 
                        "1", 
                        "2", 
                        "3"
                    ]
                }
            ]
        }
    ]
}

I can somehow count the number of elements in items, right? I tried with .length , but I don't understand something, I guess.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrew, 2017-03-21
@bloodmoonshard

Maybe so?
https://docs.mongodb.com/manual/reference/method/d...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question