How FerretDB stores BSON in JSONB

At FerretDB, we are converting MongoDB wire protocol queries into SQL, to store information from BSON to PostgreSQL.  To achieve this, we created our own mapping called PJSON which translates MongoDB’s BSON format into PostgreSQL’s JSONB.  Using BSON with JSONB offers...