mirror of
https://github.com/mongodb/mongo.git
synced 2024-11-24 08:30:56 +01:00
41 lines
799 B
C
41 lines
799 B
C
// query.h
|
|
|
|
#pragma once
|
|
|
|
#include "../stdafx.h"
|
|
#include "../grid/message.h"
|
|
#include "jsobj.h"
|
|
|
|
/* requests:
|
|
|
|
Query:
|
|
int reserved;
|
|
string collection;
|
|
int nToReturn; // how many you want back as the beginning of the cursor data
|
|
JSObject query;
|
|
GetMore:
|
|
int reserved;;
|
|
int64 cursorID;
|
|
int nToReturn;
|
|
*/
|
|
|
|
/* db response format
|
|
|
|
Query or GetMore:
|
|
int reserved;
|
|
int64 cursorID;
|
|
int startingFrom;
|
|
int nReturned; // 0=infinity
|
|
list of marshalled JSObjects;
|
|
*/
|
|
|
|
struct QueryResult : public MsgData {
|
|
long long cursorId;
|
|
int startingFrom;
|
|
int nReturned;
|
|
const char *data() { return (char *) (((int *)&nReturned)+1); }
|
|
};
|
|
|
|
QueryResult* runQuery(const char *ns, int ntoreturn, JSObj);
|
|
|