0

    {
        "_id" : ObjectId("111"),
        "id" : "111",
        "classification" : [ 
            {
                "annotator" : "annotatorName1",
                "category" : "white"
            }, 
            {
                "annotator" : "annotatorName2",
                "category" : "white"
            }, 
            {
                "annotator" : "annotatorName3",
                "category" : "black"
            }
        ]
    }

   {
        "_id" : ObjectId("222"),
        "id" : "222",
        "classification" : [ 
                   {
                "annotator" : "annotatorName1",
                "category" : "white"
            }, 
            {
                "annotator" : "annotatorName2",
                "category" : "blue"
            }, 
            {
                "annotator" : "annotatorName3",
                "category" : "black"
            }
        ]
    }

  {
        "_id" : ObjectId("333"),
        "kind" : "youtube#video",
        "etag" : "tagvalue",
        "id" : "333"
    }

{
        "_id" : ObjectId("222"),
        "id" : "222",
        "classification" : [ 
            {
                "annotator" : "annotatorName1",
                "category" : "white"
            }, 
            {
                "annotator" : "annotatorName2",
                "category" : "blue"
            }, 
            {
                "annotator" : "annotatorName3",
                "category" : "black"
            }
        ]
    }

|

    1

    0

    db.collectionName.aggregate([
      {$match : {classification : {$exists : true}}},
      {$unwind: "$classification"},
      {$group: { _id: "$id", uniqueCategories: {$addToSet: "$classification.category"}}},
      {$project: {_id : 1, numberOfCategories: {$size: "$uniqueCategories"}} },
      {$match: {numberOfCategories: 3} }
    ])
    

    |