logo
ICYMI: AWS Gave Amazon CodeWhisperer a Major Upgrade for MongoDB Projects

ICYMI: AWS Gave Amazon CodeWhisperer a Major Upgrade for MongoDB Projects

CodeWhisperer upgraded for MongoDB projects, providing tailored intelligent suggestions to help developers write code faster in their IDE.

BJ
Brooke Jamieson
Amazon Employee
Published Dec 13, 2023
Last Modified Dec 15, 2023

Working in DevRel at AWS in November is a fever dream - it reminds me of the lead up to the end of year dance recitals I did every year growing up. There’s so much prep behind the scenes, and so many rehearsals with so many people, that everything before the curtain goes up just turns into a blur.
The road to re:Invent is equal parts busy and exciting, and I can confirm waiting in the wings feels remarkably similar whether you’re going on stage to do Irish dancing or give a tech talk. A downside of this is that some updates get lost in the blur of lights, stages and curtains, so December has always been a time where I put things back together, and shine a spotlight on things that got lost along the way.
In this article, I want to spotlight the enhancements for Amazon CodeWhisperer that happened behind the scenes with AWS and MongoDB. Admittedly this is not new news - the collaboration was announced in early November in PR Newswire, TechCrunch and on MongoDB’s website, but it deserves some love here too!

Amazon CodeWhisperer is your AI-powered productivity tool for the IDE and command line, providing real-time suggestions in over 15 languages, including Python, Java, and JavaScript. AWS and MongoDB already have a long history of working together to help builders accelerate and simplify their cloud migration, so collaborating to give CodeWhisperer special powers for MongoDB, to give builders a better and more efficient experience makes a lot of sense.
MongoDB worked with the Amazon CodeWhisperer product and data science teams within AWS to provide specialized training for the foundation model on key MongoDB use cases. This means that whenever you’re using Amazon CodeWhisperer in your IDE to work on MongoDB projects, you’re going to see even more nuanced and efficient code suggestions. Having great quality suggestions for MongoDB projects extends the native experience in CodeWhisperer, and for me, this means being able to keep VS Code open full screen, without having to switch between a million browser tabs with MongoDB documentation open.
The active input from MongoDB during iterative evaluations means the underlying model has now been specifically tuned for MongoDB tasks, so the real time suggestions you’ll get based on your existing code and the comments you’re writing will be much more accurate. The teams worked together to incorporate curated MongoDB content and code from docs, use cases, data aggregations and common tasks, and this training focused on 5 core languages: Python, Java, JavaScript, C#, and Go.
So, if you’re a MongoDB developer and you haven’t tried Amazon CodeWhisperer since October (or at all!) get started and experience the upgrades for MongoDB tailored recommendations that will help you follow best practices and syntax.

Getting started with Amazon CodeWhisperer is as easy as 1, 2, 3!

CodeWhisperer comes built in with AWS Cloud9 and the AWS Lambda console, and you can click the following links to install it for VS Code, Visual Studio, JetBrains (e.g., IntelliJ IDEA), Command line, Amazon SageMaker Studio, JupyterLab and AWS Glue Studio Notebook.

If you’re using the Individual tier, sign in with your Builder ID, and if you’re using the Professional tier, sign in with IAM Identity Center.

Now you’re good to go! Open your editor of choice, and CodeWhisperer will be ready and waiting! You’ll start to see code suggestions in real time as you type, and you can also manually trigger CodeWhisperer using Alt+C on Windows or Option+C on MacOS.

In this Python example, we’re trying to find an object in the MongoDB test database within the students collection, as highlighted in the initial comment. Using 'pymongo', it connects to MongoDB with a URI from an environment variable, accesses the test database, and singles out the students collection. It then searches for a student named John and prints the details if found.
Of course, this is just a toy example to demonstrate the basic capabilities, but I’d love to hear from you if you’re using this for something more exciting!
1
2
3
4
5
6
7
8
9
10
11
12
13
14
import pymongo
import os

# Find an object in mongodb test database in collection students

ATLAS_URI = os.environ.get('ATLAS_URI')

client = pymongo.MongoClient(ATLAS_URI)

db = client.test
collection = db.students

student = collection.find_one({"name": "John"})
print(student)

MongoDB and Amazon CodeWhisperer's collaboration is a win-win for developers. With CodeWhisperer's specialized training on MongoDB, builders like you can write code faster with fewer context switches. You’ll get real-time, intelligent suggestions tailored specifically for MongoDB projects in your IDE, following best practices and proper syntax.
I encourage you to try out CodeWhisperer if you work with MongoDB, and if you haven’t used CodeWhisperer in a few months it’s definitely worth a new look. See for yourself how the MongoDB-optimized suggestions can accelerate your development.
As AWS and MongoDB continue collaborating, I hope we can expect even more refinements to CodeWhisperer's MongoDB recommendations to further empower developers with AI.

Any opinions in this post are those of the individual author and may not reflect the opinions of AWS.