Details
-
Improvement
-
Resolution: Won't Do
-
Major - P3
-
None
-
None
Description
1. module info:
db version v3.2.4
|
git version: nogitversion
|
allocator: tcmalloc
|
modules: none
|
build environment:
|
distarch: x86_64
|
target_arch: x86_64
|
2. issue info
The following is the OP_REPLY struct of mongodb wire protocol.
_struct {
|
MsgHeader header; // standard message header
|
int32 responseFlags; // bit vector - see details below
|
int64 cursorID; // cursor id if client needs to do get more's
|
int32 startingFrom; // where in the cursor this reply is starting
|
int32 numberReturned; // number of documents in the reply
|
document* documents; // documents
|
}_
|
When the cursorID is set to non-zero in a reply, it implies there are more data, and client should do get more's.
However, the cursorID is always set to zero in replies of aggregate request, even if there are more data. Actually the cursor id is set in the "documents"..
This behavior is not following the standard protocol.
3. request&reply info
the request is like that:
??
|
[
|
{
|
"$match" : {
|
"_isdelete" : 0,
|
"_uid" : 444629226
|
}
|
},
|
{
|
"$group" : {
|
"ctime" : {
|
"$max" : "$ctime"
|
},
|
"_id" : {
|
"name" : "$name"
|
}
|
}
|
},
|
{
|
"$sort" : {
|
"_id" : 1
|
}
|
},
|
{
|
"$skip" : 0
|
},
|
{
|
"$limit" : 400
|
}
|
]
|
??
|
the reply bytes is like that:
messageLength: 40263
|
requestID:125067217
|
responseTo:9
|
opCode: OP_REPLY
|
responseFlags:0x4
|
cursorID:0
|
startingFrom:0
|
numberReturned: 1
|
documents: {
|
"waitedMS":0,
|
"cursor": {
|
"id":22321923528,
|
"ns": "test.test0"
|
"firstBatch": ...
|
}
|