0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-11-28 07:59:02 +01:00
mongodb/db/query.h
2007-10-28 16:38:06 -04:00

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);