(MongoDB's NOT will also return documents with missing values which is not allowed accoording the OPTMIADE standard. An alternative would be to add an extra expression to check wether a certain entry is present in a Document.
This is a good point that we may not be testing currently (I believe we only test "required" fields in our filter tests, which cannot be null/missing). As you say, a remedy may be to add an {"$exists": True} to every comparison we perform. I think I will raise another issue for this, as we should also test that the elasticsearch backend behaves appropriately.
This is a good point that we may not be testing currently (I believe we only test "required" fields in our filter tests, which cannot be null/missing). As you say, a remedy may be to add an
{"$exists": True}
to every comparison we perform. I think I will raise another issue for this, as we should also test that the elasticsearch backend behaves appropriately.Originally posted by @ml-evs and @JPBergsma in https://github.com/Materials-Consortia/optimade-python-tools/issues/79#issuecomment-834327481