Example: Remote query logging v5

MongoDB Foreign Data Wrapper supports storing logs for queries executed on the MongoDB server directly to the PostgreSQL server logs. For example:

SET mongo_fdw.log_remote_query TO true;
SET client_min_messages TO log;
SELECT c1, c2, c6 FROM f_test_tbl1 e
  WHERE c6 > 3000
  ORDER BY c1 ASC NULLS FIRST;
LOG:  remote query: db.test_tbl1.aggregate( [ { "$match" : { "$expr" : { "$and" : [ { "$gt" : [ "$c6", 3000.0 ] }, { "$ne" : [ "$c6", null ] } ] } } }, { "$sort" : { "c1" : 1 } } ] )
 c1  |  c2  |  c6  
-----+------+------
 900 | EMP9 | 5000
(1 row)