So how does MongoDB use Python?
This was the most frequently asked question people asked us at PyCon 2019. It is understandable, since MongoDB is written largely in C++ and our main interface, the Mongo Shell, is a JavaScript interface. But the question caught me off guard, because I spent the past 6 years at MongoDB almost exclusively writing in Python. In fact, MongoDB not only sponsors events like PyCon but also encourages MongoDB engineers to attend and speak at Python events worldwide.
MongoDB at PyCon
This was my first PyCon, and I found it to be a great mix of inspirational talks, internal dives into Python, and applications of Python in the real world. At PyGotham, I was totally won over by the passionate pleas to support the Python community, and more generally, the open source community, and I wondered what PyCon had in store in this regard. I was particularly struck by Shadeed “Sha” Wallace-Stepter who learned to program in prison and completely transformed his life. But after the conference had ended, the question lingered in my head: what does MongoDB have to do with Python?
Python@Mongo
Let’s start with the obvious one: Python developers who have used MongoDB before are probably familiar with the PyMongo package, the open-source Python interface to MongoDB also maintained by MongoDB. But you may be surprised to find that Python is much more pervasive at MongoDB. For example, some of the same developers who maintain PyMongo also develop and maintain another project called PyMODM, an object-document mapping library intended to make accessing and manipulating data more convenient than database drivers. And Jesse Davis is a Python contributor. Our documentation team also uses Python quite heavily to develop their tools and libraries.
Using Python@MongoDB
As with many other companies, we also use Python heavily for scripts and one-off jobs internally. Python is usually our tool of choice when we need to write code that is shared between teams, as people generally assume that if you are a developer, you probably know Python. As an example, when we were exploring third-party authentication APIs, two teams independently wrote client libraries in Python for different parts of the API expecting that the rest of the company would benefit from the work.
Python at MongoDB University
Finally, I want to mention my own team, MongoDB University. Our web application backend is almost entirely in django. We primarily work on the server side, so almost all of our code is written in Python. The MongoDB University website is a great dogfooding opportunity for MongoDB products, and we take full advantage. For instance, we store course and student progress data in MongoDB Atlas and use PyMODM for data modeling. PyMODM also handles interactions with the PyMongo driver. This turned out to be a great way to help the Python driver team identify bugs in PyMODM and improve it.
We also teach a free online course for Python developers who want to learn MongoDB!
At MongoDB, we love Python, we use it everyday, and we even sponsor Python events (and yes, we’re on Python 3) We hope to see you at your next local Python event!
And the next Python event you can meet with MongoDB people is EuroPython in Basel, Switzerland from July 8th to 14th. Drop in and say hi!