Reputation: 41
I am completely new to mongoDB,I have this below query:
jds=jd.aggregate( [
{
"$group": {
"_id": {"house_NAME":"$house_NAME"},
"count": { "$sum": 1 }
}
},
{ "$match": { "count": { "$gt": 0 } } }
] )
which returns count of each house name present in the collection.
my collection is somewhat like below :
record_id house_NAME status
1 Thomas Open
2 Panther Close
3 Thomas Close
what I want is to only return the value whose status is "Open", I want to add "and" clause in above query so it return the count of only those documents whose status "Open". I don't know how exactly to do it.
I am stucked in it .any help will be greatly appreciated !
Thanks in advance !
Upvotes: 2
Views: 46