Using Mingo with FerretDB
Mingo is a suitable solution for a GUI for MongoDB and its open-source alternative, FerretDB. Since FerretDB is open source, developers can fully control and adapt it to suit specific needs. FerretDB with Mingo will offer you a visual representation of data and a user-friendly interaction, among other benefits.
What is FerretDB
FerretDB is the open-source alternative for MongoDB. Initially, MongoDB was open source, and due to its robust documentation, it was preferred by developers needing an open-source database. FerretDB was founded when MongoDB switched to an SSPL license abandoning its open-source roots. The change in license by MongoDB made it unusable for many Open Source and Commercial Projects. Unlike MongoDB, FerretDB is under Apache License 2.0. FerretDB is the perfect solution for MongoDB users searching for an open-source alternative. The icing on the cake is that you can run similar MongoDB protocol queries without learning a new language.
In a recent interview, Alexey Palazhchenko, the CTO at FerretDB, stated that they aimed for their software to work with unmodified MongoDB drivers and applications. Another main idea before creating the software is that it should not store data by itself. True to it, FerretDB does not store data but is built on top of PostgreSQL. This implies that PostgreSQL is FerretDB’s main backend which is fully supported. FerretDB also supports SQLite back end and is working on having an SQLite backend and SAP on HANA compatibility. The reason for having multiple backend alternatives is that users may want to use different backends for performance reasons.
The founders of FerretDB are always keen to emphasize that it is not another NoSQL database. Rather, it helps you leverage the power of the MongoDB ecosystem. That way, you can use all tools, drivers, and UIs like you would with MongoDB. Additionally, you can use the same query language and run it all on PostgreSQL or SQLite.
How FerretDB works
FerretDB is built on top of PostgreSQL. It stores documents in binary JSON format using the corresponding PostgreSQL column type. Since it does not store data by itself, it leverages the tables in PostgreSQL to store database structure information like database names, collections, and user access management. It translates MongoDB wire protocol queries to SQL for compatibility with existing software and tools built on MongoDB. The FerretDB community is addressing any incompatibility issues that emerge.
Benefits of using FerretDB
- Open source and huge community: FerretDB’s open-source nature allows developers to have full control over it and can adapt it to suit specific needs. This is coupled with the large online community of developers and engineers willing to help you in case of any technicalities.
- PostgreSQL backend: The software primarily runs on a PostgreSQL backend which is also open source. PostgreSQL is highly reliable and equally has a large community. You will also benefit from its ability to handle large amounts of data and complex queries, which can be an added advantage.
- User-friendly: This is the case, especially if you have been a MongoDB user. You can kickstart your journey with FerretDB without learning new syntax. There is also no need to learn a new language.
- Best of both worlds: When using FerretDB, you can build on proven and reliable open-source software. At the same time, FerretDB has MongoDB-like APIs and features developers love.
FerretDB and Mingo Setup
Scaleway and Civo MarketPlace are two cloud providers that have availed FerretDB for installation. However, for this setup, we will use Docker for installation. FerretDB Docker installation offers a complete guide on installing the software on Docker. If you do not have Docker installed on your machine, you should start by setting up Docker.
With that, you have FerretDB installed and ready to use with Mingo.
Mingo has first-class support for FerretDB, but FerretDB is not 100% compatible with MongoDB API, so some of the features are not usable. To get Mingo, we need to visit the Mingo website to get the appropriate version for our machines. The second step is downloading the desktop application in macOS, windows, and Linux.
Connect Mingo with the FerretDB instance
Open Mingo and click “New Connection” on the welcome screen to set up a connection. That way, you should be able to set up your connection. Proceed to connect FerretDB Mingo using MongoDB URI.
Basic operations
Like when using MongoDB, existing databases in the FerretDB instance will be displayed in the list of available databases on the Mingo screen. Alternatively, you can create a database and add collections by clicking “Add Collection.” Going forward, you can execute any operation as you would when using MongoDB on Mingo.
Advanced operations
FerretDB can perform complex operations using aggregation pipelines to transform data. This cements the fact that it is an open-source alternative to MongoDB. Other than aggregat
e
, count
, and distinct
aggregation pipeline commands, FerretDB supports the following aggregation pipeline stages:
- $count
- $group
- $limit
- $match
- $out
- $skip
- $sort
- $unwind
A list of the supported FerretDB commands can be found here.
Finally, FerretDB also supports unique index creation. It is another advanced operation you can perform in these fields.