chapter three

3 Communicating with MongoDB

 

This chapter covers

  • An overview of The MongoDB Wire Protocol
  • Customizing MongoDB Shell
  • Introducing MongoDB Compass GUI
  • Connecting to MongoDB database using Node.js driver
  • Communicating with MongoDB using Python driver
  • Querying MongoDB with Ruby drivers

In this chapter, I explore the fundamentals of MongoDB interaction, highlighting the MongoDB Wire Protocol. I'll show you how to customize the MongoDB Shell for your development needs and introduce MongoDB Compass, a user-friendly graphic user interface (GUI). I'll demonstrate how to connect your applications to MongoDB using Node.js, Python, and Ruby drivers (widely used with MongoDB), providing a thorough understanding of database connectivity.

3.1 Discovering MongoDB Shell

3.1.1 Connecting to MongoDB Atlas

3.1.2 Connecting to Self-Hosted Deployments

3.1.3 Performing operations

3.1.4 Viewing MongoDB Shell Logs

3.1.5 Running scripts in mongosh

3.1.6 Configuring mongosh

3.1.7 Using .mongoshrc.js

3.2 Playing with MongoDB Compass

3.3 Connecting using MongoDB Drivers

3.3.1 Using Node.js Driver

3.3.2 MongoDB and TypeScript

3.4 Employing Python Drivers

3.4.1 PyMongo

3.4.2 Motor (Python Async Driver)

3.4.3 PyMongo vs Motor

3.5 Integrating Ruby Drivers

3.6 Learning Mongoid

3.7 Summary