Release of FerretDB 0.1, MongoDB implementation based on PostgreSQL DBMS

The FerretDB 0.1 (formerly MangoDB) project release has been published, allowing you to replace the MongoDB document-oriented DBMS with PostgreSQL without making changes to the application code. FerretDB is implemented as a proxy server that translates calls to MangoDB into SQL queries to PostgreSQL, which allows you to use PostgreSQL as the actual storage. The code is written in Go and distributed under the Apache 2.0 license.

The need for migration may arise due to the transition of MongoDB to a non-free SSPL license, which is based on the AGPLv3 license, but is not open source, since it contains a discriminatory requirement to provide under the SSPL license not only the application code itself, but also the source codes of all components involved in providing cloud service.

The target audience for FerretDB is users who do not use the advanced features of MongoDB in their applications, but want to use a completely open software stack. At the current stage of development, FerretDB still supports only a part of the MongoDB features that are most often used in typical applications. In the future, they plan to achieve full compatibility with drivers for MongoDB and provide the ability to use FerretDB as a transparent replacement for MongoDB.

Recall that MongoDB occupies a niche between fast and scalable systems that operate on data in the key / value format, and relational DBMS, functional and convenient in generating queries. MongoDB supports storing documents in a JSON-like format, has a fairly flexible language for generating queries, can create indexes for various stored attributes, efficiently provides storage of large binary objects, supports logging of operations to change and add data to the database, can work in accordance with the paradigm Map/Reduce, supports replication and building fault-tolerant configurations.

The release of FerretDB 0.1.0 has completely redesigned the way data is retrieved from PostgreSQL. Previously, for each incoming MongoDB request, one SQL query was generated to PostgreSQL, using functions to work with the JSON format and filtering the results on the PostgreSQL side. Due to differences in the semantics of the PostgreSQL and MongoDB json functions, there was a mismatch in behavior when comparing and sorting different types. To solve this problem, a redundant data sample is now extracted from PostgreSQL, and the filtering of the result is performed on the FerretDB side, which made it possible to repeat the behavior of MongoDB in most situations.

The cost of increased compatibility was a performance penalty, which in future releases is expected to be compensated by selective filtering on the FerretDB side of only queries for which there is a divergence of behavior. For example, the query "db.collection.find({_id: 'some-id-value'})" can be processed entirely in PostgreSQL. The primary goal of the project at this stage of development is to achieve compatibility with MongoDB, and performance is still relegated to the background. Of the functional changes in the new version, support for all bit operators, the "$eq" comparison operator, as well as the "$elemMatch" and "$bitsAllClear" operators, is noted.

Source: opennet.ru

Add a comment