MongoDB Atlas (Finally) Gets a Command Line Interface – The New Stack

The CLI is where developers live and breathe on a daily basis, so it’s no surprise that MongoDB’s New Command Line Interface (CLI) for its Atlas Database Service was welcomed with open arms by customers during a limited release and was enthusiastically received during the MongoDB World conference keynote last week.

MongoDB CLI, mongocli for installing terminals, is Atlas’ new dedicated command line interface that allows customers to manage Atlas services through the command line rather than the GUI, which was previously a requirement. Not to be confused with mongo shell which is another command-line tool that already exists but is limited to data queries, updates, and other administrative tasks. MongoCLI works hand in hand with the Mongo shell and they are distributed together.

With the overall launch date target set for the start of the conference, the team soft-launched much earlier internally to begin testing features, working on documentation, and improving/adding features. One of the first features of the CLI was OIDC authentication.

“Before, you had to use API keys and the process to achieve this was tedious. So we started with the Atlas login experience, which is seamless at the moment; you just need to enter your username and password password and authenticate in the CLI,” said the MongoDB product manager Jakub Lazinskiin an interview with The New Stack.

The next thing the CLI team tackled was the onboarding experience, Atlas configuration; MongoDB CLI now makes it easier to get started with Atlas.

“With the onboarding experience, the cool part is that we’re configuring a lot of things that you had to do manually before,” Lazinski said of how the CLI streamlines Atlas’ workflow. What used to take several steps to get up and running can now be done with a few keystrokes with the command line.

The CLI is feature-rich, including creating databases, creating clusters, loading sample data, deploying to a test environment, and many other options. The CLI will grow as Alas does and the team intends to keep the CLI up to date.

“When a new feature comes to Atlas, it takes a day or two to add it to the CLI,” said Gustave Bazanthe MongoDB engineer who created the CLI.

For developers by developers

Like most of the products announced at MongoDB World Conference 2022, MongoCLI is a development tool although this one is really only a tool for developers by developers.

When asked how this project got started, Bazan exclaimed, “The CLI is my baby!” Bazan started working at MongoDB about three years ago. One of his first professional tasks, a repetitive task required him to use the GUI and prompted him to ask around in an effort to see if there was a CLI or a way to automate to enable him to concentrate his efforts elsewhere. There was not.

Fast forward to MongoDB’s annual hackathon, Skunkworks. This is when MongoDB employees have a designated week to work across teams on projects and ideas that aren’t critical path oriented.

Bazan chose to use his Skunkworks time to build a primitive CLI prototype with very limited functionality. Although lightweight, it had just enough capability to garner support from the product and the engineering leadership team.

Engineering team and technical challenges

One of the early challenges of the CLI project was getting dedicated time on the schedule, but that’s really where the engineering leadership and product teams came in. After porting the project, a dedicated quarter-time and an additional engineer, bringing the total to two engineers dedicated to the project full-time.

But the challenges didn’t stop there, as Bazan says: “I knew what a CLI was, but I never built one. »

The team chose to write in Golang and use the Cobra CLI frame, which was new to everyone. So there was a technical learning curve but little by little everything fell into place.

The original MVP functionality was to create a cluster and a database user. It was a slow, step-by-step learning process that “This is how you create a cluster, this is how you do these things, this is how they all come together,” Bazan said.

One of the key takeaways was that the CLI experience should be very user-friendly. Bazan said. “At one point, we spent a lot of time improving error handling and the way we displayed things, because we were just throwing away JSON coming back from the server.”

There are now four full-time dedicated CLI engineers and more features in the pipeline, although there are no official release dates for anything else at this time.