From 9d8529e8cb8035887020f62e75768293edc63792 Mon Sep 17 00:00:00 2001 From: Swapnoneel Saha <121167506+Swpn0neel@users.noreply.github.com> Date: Wed, 29 Nov 2023 15:09:38 +0530 Subject: [PATCH] (fix): Updated MongoDB support doc 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. --- .../version-2.0.0/dependencies/mongo.md | 23 ++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/versioned_docs/version-2.0.0/dependencies/mongo.md b/versioned_docs/version-2.0.0/dependencies/mongo.md index cc83f5f30..358bd3f9f 100644 --- a/versioned_docs/version-2.0.0/dependencies/mongo.md +++ b/versioned_docs/version-2.0.0/dependencies/mongo.md @@ -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.

+ +Port : The default port number for `mongod` and `mongos` instances is 27017. The port number for `mongod` and `mongos` is configurable and may vary.
+Byte Ordering : All integers in the MongoDB wire protocol use little-endian byte order: that is, least-significant byte first.
+Message Types : 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`.

+ +For more information, check [here](https://www.mongodb.com/docs/manual/reference/mongodb-wire-protocol/#standard-message-header) ## How it works ? @@ -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:

+![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:

+![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.