FerretDB The MongoDB Drop-In Replacement Is Production Ready
Written by Nikos Vaggalis   
Thursday, 27 July 2023

FerretDB moves your application workloads from MongoDB to PostgreSQL. Why is that big a deal?

FerretDB, previously MangoDB (yes, Mango, this is not a typo!) is:

a stateless proxy, which converts MongoDB protocol queries to SQL, using PostgreSQL as a database engine.
It is compatible with MongoDB drivers, and should work as a drop-in replacement to MongoDB in many cases.

Thus allowing developers to use the powerful MongoDB interface while storing data in PostgreSQL and letting PostgreSQL understand queries from applications written for MongoDB. This way, MongoDB drivers and even tools can be used with an application which would otherwise rely on MongoDB, while still benefiting from the ease and flexibility of a document database, especially given Postgres' strong JSON capabilities.

ferretdb-v1

The other reason for using FerretDB is wanting to use a true Open Source MongoDB. But wait, isn't MongoDB itself open source? Yes, but in 2018 it introduced an extreme copyleft licence, Server Side Public License(SSPL) which, while a source-available software license is unusable for many Open Source and Commercial Projects. In contrast, FerretDB is released under the Apache 2.0 license.

After much time in development, FerretDB is now production-ready, adding notable features such as support for aggregation pipelines, indexes, and authentication. One of those features is the addition of the "createIndexes" command:

This will enable you to specify the fields you want to index, and also the type of index to use (e. g. ascending, descending, or hashed). For instance, suppose you have a users collection containing several fields, including "age", "name", and "email", and you want to create an index on the "age" field. You can now run the following command:

db. users. createIndex({ age: 1 })

and create an ascending index on the "age" field, which will speed up any queries that filter on that field.

Another feature in helping you gather more information about your collections, databases, and server performance. For instance to retrieve statistics about a collection, use the collStats command like this:

db. runCommand({ collStats: 'users' })

While FerretDB is based on PostgreSQL and as such it is the backend which will get the newest features, FerretDB is fully plugable and can support other backends like

  • Tigris
  • SAP HANA
  • SQLite

with more backends coming soon.

The engine is offered as a Docker image for production use and development, as well as in RPM and DEB packages.


If you would like to test FerretDB, there's also an All-in-one Docker image, containing everything you need to evaluate it with PostgreSQL. 

More Information

FerretDB 

Related Articles 

PlanetScale's MySQL Course For Developers  

 

To be informed about new articles on I Programmer, sign up for our weekly newsletter, subscribe to the RSS feed and follow us on Twitter, Facebook or Linkedin.

Banner


Open Source Funding Report Shows $7.7 Billion Annual Investment
06/12/2024

The inaugural 2024 OSS Funding Survey has been published with key findings including a $7.7 billion annual investment in the open source ecosystem.



Kafka 3.9 Adds Dynamic KRaft Quorums
16/12/2024

Kafka 3.9 has been released. The team says this is a major release and the final in the 3.x line. It This will also be the final major release to feature the deprecated Apache ZooKeeper mode. Kafka is [ ... ]


More News

espbook

 

Comments




or email your comment to: comments@i-programmer.info

Last Updated ( Thursday, 27 July 2023 )