MongoDB Atlas in Python
Rod Stephens · 2023
This chapter presents an example that uses Python to build a NoSQL document database in the cloud. It uses the MongoDB Atlas database to save and query data about assignments for East Los Angeles Space Academy graduates. Document databases do not have table definitions, so they need some other way to keep track of what “fields” are in a document. They do that by using formats that include both the field names and their values. The chapter shows how to store the first record in an Extensible Markup Language (XML) format document. XML also supports attributes that we can use to save some space. JavaScript Object Notation (JSON) is another format for storing documents that's currently more popular with document databases. MongoDB stores data in a binary version of JSON called Binary JavaScript Object Notation (BSON) to save space and to better encode some data types.