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


Redis Changes License, Rival Fork Launched
03/04/2024

The developers of Redis have announced that they are changing the licensing model for the database. From now on, all future versions of Redis will be released with source-available licenses rather tha [ ... ]



Insights From AI Index 2024 Report
17/04/2024

Published this week, the latest Stanford HAI AI Index report tracks worldwide trends in AI. A mix of its new research and findings from many other sources, it provides a wide ranging look at how  [ ... ]


More News

raspberry pi books

 

Comments




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

Last Updated ( Thursday, 27 July 2023 )