use('test_FreePlanet');

let aggregation = [
    {
        $match: {
            idapp: "13",
            "profile.favorite": {
                $elemMatch:
                    { id: '10256', tab: 4 }
            }
        },
    },
    {
        $group:
        {
            _id: null,
            count: { $sum: 1 },    
        }
    },
    { $project: { _id: 0 } }
];

db.users.aggregate(aggregation);