I have a collection in Mongodb called "Data", one of the fields in this collection might has multiple values. I would like to know how many values this field can get at the most (maximum number of values that this field can get). Below is the query that I run:
db.Data.find({"outcome": {$exists: 1, $ne: null} }, {"outcome":1})
Here is the result:
{ 
    "_id" :1, 
    "outcome" : [
        "3-VD"
    ]
}
{ 
    "_id" : 2, 
    "outcome" : [
        "3-VD", 
        "Left main"
    ]
}
{ 
    "_id" : 3, 
    "outcome" : [
        "1-VD",
        "2-VD",
        "3-VD",
    ]
}
I know that with below aggregation query I get number of outcome that each document has, but I want to know what is the maximum number of outcomes in this collection!!!
db.Data.aggregate({$project: { count: { $size:"$outcome" }}}) 
