Python ORM Mongo attribute with name containing "__"
One of developer is trying to query a Mongo document that has name containing __.
Example Document
{
"name":"someName"
"Identifiers":
{
"Identifier01": [ "Value1", "Value2"],
"__identntifier2__" : ["value3", "value4"]
}
}
When he is trying search in python using something like [ for a new enhancement]
filter(Identifiers____identntifier2__) in python ORM , for obvious reasons , it is throwing errors.
Any idea on how __ in the name of the attribute can be escaped and not interpreted an operator?
NOTE: We cannot change the attribute name as this is a legacy code and there are quite bit of documents with such named attribute.
Tried __ , tried f() , tried F() [ suggestion from chatGpt]