In MongoDB, I have a repository dataset. Using PyMongo, I find all individual / unique values in the collection
for testy in collection.distinct('stores'):
print(testy)
I can also find a subset of bad memory stores that interest me
for testy in collection.find({'stores': {'$in': ['Aldi','ALDI','aldi']}}):
What I want to do is find unique in this subset
According to MongoDB docs
db.runCommand ( { distinct: "inventory", key: "item.sku", query: { dept: "A"} } )
I tried a lot of combinations, adding a request $in, but cannot make it work.
source
share