Reputation: 385
In MongoDB I have a dataset of store data. Using PyMongo I am finding all of the distinct/unique values in a collection
for testy in collection.distinct('stores'):
print(testy)
I can also find a subset of badly spelt stores I'm interested in
for testy in collection.find({'stores': {'$in': ['Aldi','ALDI','aldi']}}):
What I want to do is find the unique in this subset
According to the MongoDB docs
db.runCommand ( { distinct: "inventory", key: "item.sku", query: { dept: "A"} } )
Tried lots of combinations adding the query doing the $in
but can't get it to work.
Upvotes: 9
Views: 16043