Skip to main content

MongoDB GUI: Query and Filter FerretDB Instance with MajorM

· 5 min read
Alexander Fashakin

Query FerretDB instance with MajorM

With FerretDB, you're never short of MongoDB GUI options to choose from, and in this blog post, we'll be diving into one of them: MajorM.

Often, with proprietary software solutions like MongoDB, many find themselves constrained in terms of flexibility and costs and are always at risk of vendor lock-in. That's why truly open-source software like FerretDB is so important and attractive!

FerretDB won't constrict you or lock you in. What's even better, you get to use many of your favorite MongoDB tools with FerretDB. Because of that, you can easily leverage a MongoDB GUI like MajorM for FerretDB, just as you would for MongoDB.

MajorM is a simple MongoDB GUI desktop app that provides fast and complex query searches, visual query builder, and drag-and-drop functionality. It also provides a mongoshell UI for advanced operations on your FerretDB instance.

This guide is just one of a series of blog posts focusing on using MongoDB GUI tools to query and filter FerretDB instances. See other blog posts below:


Before we get started, ensure to have the following set up before proceeding to other parts of the blog post.

Set up FerretDB

Follow this Docker installation guide to launch an instance of FerretDB and have your connection string ready.

For this tutorial, we'll be setting up our docker-compose file with the following configurations.

image: postgres
- POSTGRES_USER=username
- POSTGRES_DB=ferretdb
- ./data:/var/lib/postgresql/data
restart: on-failure
- 27017:27017
- FERRETDB_POSTGRESQL_URL=postgres://postgres:5432/ferretdb
name: ferretdb

Here, we've set up the ferretdb service to connect to the postgres service, as it translates MongoDB commands into SQL for the underlying PostgreSQL backend. Then we'll launch the services with run docker compose up -d.

Set up the MajorM connection to FerretDB

Launch your installed MajorM application.

Click "New Connection" to connect to FerretDB.

New Connection section

This takes you to the connection window, where you'll need to specify the connection string to the FerretDB instance.

New Connection window

In the connection window, specify the name and connection URI for the FerretDB instance: mongodb://username:password@ Then, test the connection to be sure it's valid. If successful, save the connection.

Connection window with URI


For the MongoShell in MajorM to work, you'll need to specify your mongosh binary path. If you have mongosh installed. You can get this by running which mongosh on macOS and other Linux systems or where mongosh for Windows systems.

Once the connection is successful, MajorM will display all the databases and collections in that instance.

Running FerretDB operations in MajorM

Great! Let's run some basic queries on the FerretDB instance. We'll be querying the data in the supply collection of the ferretdb database.

Test1: Get a single data record using Mongo Shell

MajorM provides the option to use Mongo shell to execute queries and scripts. From the Mongo shell, let's run to retrieve a single record from the collection.

Note that you will need to set the database to ferretdb.

Set database to ferretdb

The MajorM UI will display the data record once you click execute.

findOne command

Test2: Display all data records

You can also get all the records in the collection by navigating to supply collection and double-clicking. This action displays all the data in the supply collection as you can see in the image below:

List of all data records

Test3: Use visual query builder to query collection

Here, we'll use the MajorM's Query Builder to filter the FerretDB collection.

Query Builder

Using the visual query builder, drag and drop fields from the supply collection into the builder.

Drag and drop fields to Query Builder

Test4: Use sort and limit to filter

You can filter the response from the last example further by applying sort and limit on the returned documents.

Sort and limit

Test5: Run aggregation operations using Mongo shell

You can also take advantage of the Mongo shell in MajorM to run all the supported aggregation operations in FerretDB. For instance, let's select the top 5 customers by the total quantity of books purchased.

Drag and drop fields to Query Builder

Query FerretDB instance with MajorM

Sure, it's never easy switching to a new technology; then again, ensuring that it works with all your other applications is another matter entirely. When moving away from MongoDB to adopt FerretDB, knowing that you can use the same MongoDB commands and leverage just about any tool as you would in MongoDB is a huge perk.

MongoDB GUI applications like MajorM are very useful when managing large amounts of data. They offer users simple, and engaging UI, making it easy to run queries in FerretDB, and we can't wait for you to try them out.

If you're interested in learning more about the FerretDB project, check our GitHub repo here.

Feel free to message us on any of our community channels if you have any questions, suggestions, or interest in FerretDB – we look forward to hearing from you.