I am trying to fetch data based on filter based queries. Right now I am using
filter_stuff = {'url': 1, 'organization_name': 1, 'hum_pred':1, 'ml_pred':1, '_id': 0}
myData = list(crawlcol.find({'hum_pred': 'null'}, filter_stuff))
This will fetch data where hum_pred have values null.
hum_pred and ml_pred will have values valid invalid or null
How is it possible to fetch data which has field values hum_pred is null and ml_pred is valid or invalid
sample data
[
{"url":"www.example1.com","organization_name":"abc","ml_pred":"Valid", "hum_pred":"invalid"},
{"url":"www.example2.com","organization_name":"gvg","ml_pred":"Invalid", "hum_pred":"null"},
{"url":"www.example3.com","organization_name":"hsg","ml_pred":"null", "hum_pred":"null"},
{"url":"www.example4.com","organization_name":"hga","ml_pred":"Valid", "hum_pred":"valid"},
{"url":"www.example5.com","organization_name":"tre","ml_pred":"Invalid", "hum_pred":"valid"}
]
Expected Output
[{"url":"www.example2.com","organization_name":"gvg","ml_pred":"Invalid", "hum_pred":"null"}]
$orand$andlogical query operators.list(crawlcol.find({$and: [{$or: [{"ml_pred": "Valid"},{"ml_pred": "Invalid"}]}],{"hum_pred": "null"}}, filter_stuff))but I am getting an errorSyntaxError: invalid syntax"$or",'hum_pred', ....