Using Java I create a complex MongoDB query and before execute it usually I log the query:
log.info("Filter: {}", queryFilter);
The log is usefull but the queryFilter
is printed is this form:
And Filter{filters=[Filter{fieldName='FinInstrmGnlAttrbts.ClssfctnTp', value=RFBTCB}, [...] ]}
I would like to log the query in "Javascript form" in the same way it should execute directly into MongoDB, like:
{$and : [ {'FinInstrmGnlAttrbts.ClssfctnTp' : 'RFBTCB'}, [...] ]}
In this way, if a day an error will occur I can take directly the query from the log and test it in MongoDB, without retype the entire query manually.
Is it possible in any way?