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


Run WebAssembly Components Inside Node.js With Jco
28/03/2024

Jco 1.0 has been just announced by the Bytecode Alliance.It's a native JavaScript WebAssembly toolchain and runtime that runs Wasm components inside Node.js. Why is that useful?



Apache Shiro 2.0 Released
21/03/2024

Apache Shiro 2.0 has been released. The Java security framework now requires at least Java 11, and has added support for Jakarta EE 10.


More News

raspberry pi books

 

Comments




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

Last Updated ( Thursday, 27 July 2023 )