0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-11-24 08:30:56 +01:00
mongodb/db/query.h

41 lines
799 B
C
Raw Normal View History

2007-10-20 01:35:48 +02:00
// query.h
#pragma once
#include "../stdafx.h"
#include "../grid/message.h"
2007-10-28 21:38:06 +01:00
#include "jsobj.h"
2007-10-20 01:35:48 +02:00
2007-10-28 19:42:59 +01:00
/* 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
2007-10-20 01:35:48 +02:00
Query or GetMore:
int reserved;
2007-10-28 19:42:59 +01:00
int64 cursorID;
int startingFrom;
2007-10-28 21:38:06 +01:00
int nReturned; // 0=infinity
2007-10-20 01:35:48 +02:00
list of marshalled JSObjects;
2007-10-28 21:38:06 +01:00
*/
2007-10-20 01:35:48 +02:00
struct QueryResult : public MsgData {
2007-10-28 19:42:59 +01:00
long long cursorId;
int startingFrom;
2007-10-20 01:35:48 +02:00
int nReturned;
2007-10-28 21:38:06 +01:00
const char *data() { return (char *) (((int *)&nReturned)+1); }
2007-10-20 01:35:48 +02:00
};
2007-10-28 21:38:06 +01:00
QueryResult* runQuery(const char *ns, int ntoreturn, JSObj);
2007-10-20 01:35:48 +02:00