mongo通信协议
先是一个包头:
struct MsgHeader {
int32 messageLength; // total message size, including this
int32 requestID; // identifier for this message
int32 responseTo; // requestID from the original request
// (used in responses from db)
int32 opCode; // request type - see table below for details
}
特点:每个请求都有个id,客户端启动的时候从0开始递增
opCode表示操作类型,根据这个处理后面真正的请求
比如查询包:
struct OP_QUERY {
MsgHeader header; // standard message header
int32 flags; // bit vector of query options. See below for details.
cstring fullCollectionName ; // "dbname.collectionname"
int32 numberToSkip; // number of documents to skip
int32 numberToReturn; // number of documents to return
// in the first OP_REPLY batch
document query; // query object. See below for details.
[ document returnFieldsSelector; ] // Optional. Selector indicating the fields
// to return. See below for details.
}
抓包情况如下:

一目了然。
官网:https://docs.mongodb.com/manual/reference/mongodb-wire-protocol/
mongo通信协议的更多相关文章
- 从PHP客户端看MongoDB通信协议(转)
MongoDB 的 PHP 客户端有一个 MongoCursor 类,它是用于获取一次查询结果集的句柄(或者叫游标),这个简单的取数据操作,内部实现其实不是那么简单.本文就通过对 MongoCurso ...
- 谈一谈NOSQL的应用,Redis/Mongo
1.心路历程 上年11月份来公司了,和另外一个同事一起,做了公司一个移动项目的微信公众号,然后为了推广微信公众号,策划那边需要我们做一些活动,包括抽奖,投票.最开始是没有用过redis的,公司因为考虑 ...
- RPC框架实现 - 通信协议篇
RPC(Remote Procedure Call,远程过程调用)框架是分布式服务的基石,实现RPC框架需要考虑方方面面.其对业务隐藏了底层通信过程(TCP/UDP.打包/解包.序列化/反序列化),使 ...
- 【分布式】Zookeeper序列化及通信协议
一.前言 前面介绍了Zookeeper的系统模型,下面进一步学习Zookeeper的底层序列化机制,Zookeeper的客户端与服务端之间会进行一系列的网络通信来实现数据传输,Zookeeper使用J ...
- MongoDB分组汇总操作,及Spring data mongo的实现
转载请在页首注明作者与出处 一:分组汇总 1.1:SQL样例 分组汇总的应用场景非常多,比如查询每个班级的总分是多少,如果用关系形数据库,那么sql是这样子的 ),class from score g ...
- mongo DB for C#
(1)Download the MongoDB C#驱动. http://www.nuget.org/packages/mongocsharpdriver/. (2) Add Reference to ...
- Mongo基础使用,以及在Express项目中使用Mongoose
MongoDB的基本使用 MongoDB特点: 使用BSON存储数据 支持相对丰富的查询操作(相对其他nosql数据库) 支持索引 副本集(支持多个实例/多个服务器运行同个数据库) 分片(数据库水平扩 ...
- 【mongo】mongoVUE使用
1.查询存在字段"test"的项 {"test":{$exists:true}} 2.在表中插入字段 {$set:{"}} 3.正则匹配 {" ...
- mongo遍历表
$mongo = new MongoClient("mongodb://192.168.8.189:27017"); $collectObj = $mongo->select ...
随机推荐
- python selenium-5根据unittest组织测试用例
driver:浏览器driver存放地址 testcase:测试用例目录 report:测试结果保存目录 runtest.py:执行文件 test_search1.py搜索selenium,test_ ...
- ossfs工具将OSS挂载到阿里云linux系统目录例子
ossfs 是基于 aliyun OSS 的 fuse 客户端了,所以我们把它用在阿里云上肯定是没有错了,下面来看一篇关于ossfs工具将OSS挂载到阿里云linux系统目录例子,具体的细节如下文介绍 ...
- 基于sklearn的 BaseEstimator开发接口:模型融合Stacking
转载:https://github.com/LearningFromBest/CMB-credit-card-department-prediction-of-purchasing-behavior- ...
- HAproxy使用
参考官网 安装HAproxy/ pull 官方镜像 本地安装:本地安装路径:/usr/local/haproxy/配置: 添加:/usr/local/haproxy/conf/haproxy.cfg添 ...
- Openstack虚机实例状态错误手工恢复vm_state:error
Openstack虚机实例状态错误手工恢复vm_state:error 1.找到状态为出错状态的VM.在数据库里面表现Status为ERROR而非ACTIVE. 2.找到出错状态VM的UUID. 3. ...
- 0_Simple__simpleLayeredTexture
二维分层纹理 ▶ 源代码.用纹理方法把元素按原顺序从 CUDA3D 数组中取出来,求个相反数再加上层数放入全局内存,输出. #include <stdio.h> #include &quo ...
- sssp maven pom
pom <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.or ...
- leetcode107
/** * Definition for a binary tree node. * public class TreeNode { * public int val; * public TreeNo ...
- 视频地址blog加密
/* JS部分 没处理兼容什么的 */ var id='<?php echo $_GET['id'];?>'; var video = document.getElementById(&q ...
- bootstrap做的导航
顶部导航:nav-tabs 左边导航:nav-list 响应式布局:div嵌套 ~ container.row.ol-lg-X 效果: 源码: <!DOCTYPE html> <ht ...