Skip to content

Commit

Permalink
(fix): Updated MongoDB support doc
Browse files Browse the repository at this point in the history
Added some missing contexts that will help users to setup Keploy with MongoDB, and also added some examples which will help the users in better understanding.
  • Loading branch information
Swpn0neel authored Nov 29, 2023
1 parent 0ef4390 commit 9d8529e
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions versioned_docs/version-2.0.0/dependencies/mongo.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,13 @@ sidebar_label: MongoDB

## Introduction

The [MongoDB Wire Protocol](https://www.mongodb.com/docs/manual/reference/mongodb-wire-protocol/) is a simple socket-based, request-response style protocol. Clients communicate with the database server through a regular TCP/IP socket.
The [MongoDB Wire Protocol](https://www.mongodb.com/docs/manual/reference/mongodb-wire-protocol/) is a simple socket-based, request-response style protocol. Clients communicate with the database server through a regular TCP/IP socket. Clients should connect to the database with a regular TCP/IP socket. <br> <br>

<b>Port : </b>The default port number for `mongod` and `mongos` instances is 27017. The port number for `mongod` and `mongos` is configurable and may vary. <br>
<b>Byte Ordering : </b>All integers in the MongoDB wire protocol use little-endian byte order: that is, least-significant byte first. <br>
<b>Message Types : </b>MongoDB uses the `OP_MSG` opcode for both client requests and database replies. There are several message formats used in older versions of MongoDB which have been deprecated in favor of `OP_MSG`. <br> <br>

For more information, check [here](https://www.mongodb.com/docs/manual/reference/mongodb-wire-protocol/#standard-message-header)

## How it works ?

Expand All @@ -16,6 +22,17 @@ Once intercepted, the proxy's functionality includes parsing these wiremessages,

The system is built to support wiremessage `MongoDB version => 5.1.X`, which refers to the specific version of the communication protocol used between the application and the MongoDB server. This version indicates the specific structure and rules governing the wiremessages exchanged between the two components.

**References**
## Example of message queries

In general, each message consists of a standard message header followed by request-specific data. The standard message header is structured as follows: <br> <br>
![image](https://github.com/Swpn0neel/docs/assets/121167506/0f8b0a26-799e-498a-877d-02645b76fc6b)

`OP_MSG` is an extensible message format used to encode both client requests and server replies on the wire.
`OP_MSG` has the following format: <br> <br>
![image](https://github.com/Swpn0neel/docs/assets/121167506/247c9be9-19de-4e7f-abef-0ed4513b8925)


**Note**

[1] MongoDB 5.1 removes support for both `OP_QUERY` find operations and `OP_QUERY` commands. As an exception, `OP_QUERY` is still supported for running the [hello](https://www.mongodb.com/docs/manual/reference/command/hello/#mongodb-dbcommand-dbcmd.hello) and [isMaster](https://www.mongodb.com/docs/v4.4/reference/command/isMaster/#mongodb-dbcommand-dbcmd.isMaster) commands as part of the connection handshake.
- MongoDB 5.1 removes support for both `OP_QUERY` find operations and `OP_QUERY` commands. As an exception, `OP_QUERY` is still supported for running the [hello](https://www.mongodb.com/docs/manual/reference/command/hello/#mongodb-dbcommand-dbcmd.hello) and [isMaster](https://www.mongodb.com/docs/v4.4/reference/command/isMaster/#mongodb-dbcommand-dbcmd.isMaster) commands as part of the connection handshake.
- In version 4.2, MongoDB removes the deprecated internal `OP_COMMAND` and `OP_COMMANDREPLY` protocol.

0 comments on commit 9d8529e

Please sign in to comment.