MongoDB packets

All communication between MongoDB clients and servers are through discrete packets. Most packet types can be sent by the client to the server, one (REPLY) by the server to the client, and one (MSG) can be sent from either side.

For full details, consult the MongoDB documentation.

Request packets

The following packet types can be sent by MongoDB clients. Note that, as of MongoDB 4.2, most commands are sent using a MSG packet, but the other types are still supported.

  • MSG: the most commonly used packet for recent MongoDB clients

  • UPDATE: update a document

  • INSERT: insert one or more documents into a collection

  • QUERY: query a collection

  • GET_MORE: retrieve more documents from a query

  • DELETE: delete documents from a collection

  • KILL_CURSORS: close an active cursor

Response packets

The following packet type can be sent by a MongoDB server:

REPLY: sent by the database in response to a QUERY or GET_MORE message