mongo::Helpers Struct Reference
#include <dbhelpers.h>
List of all members.
Classes |
| class | RemoveCallback |
Static Public Member Functions |
| static void | emptyCollection (const char *ns) |
| static void | ensureIndex (const char *ns, BSONObj keyPattern, bool unique, const char *name) |
| static DiskLoc | findById (NamespaceDetails *d, BSONObj query) |
| static bool | findById (Client &, const char *ns, BSONObj query, BSONObj &result, bool *nsFound=0, bool *indexFound=0) |
| static DiskLoc | findOne (const char *ns, const BSONObj &query, bool requireIndex) |
| static bool | findOne (const char *ns, const BSONObj &query, BSONObj &result, bool requireIndex=false) |
| static bool | getFirst (const char *ns, BSONObj &result) |
| static bool | getLast (const char *ns, BSONObj &result) |
| static bool | getSingleton (const char *ns, BSONObj &result) |
| static bool | isEmpty (const char *ns, bool doAuth=true) |
| static void | putSingleton (const char *ns, BSONObj obj) |
| static void | putSingletonGod (const char *ns, BSONObj obj, bool logTheOp) |
| static long long | removeRange (const string &ns, const BSONObj &min, const BSONObj &max, bool yield=false, bool maxInclusive=false, RemoveCallback *callback=0) |
| static BSONObj | toKeyFormat (const BSONObj &o, BSONObj &key) |
| static void | upsert (const string &ns, const BSONObj &o) |
Detailed Description
all helpers assume locking is handled above them
Definition at line 39 of file dbhelpers.h.
Member Function Documentation
| static void mongo::Helpers::emptyCollection |
( |
const char * |
ns |
) |
[static] |
| static void mongo::Helpers::ensureIndex |
( |
const char * |
ns, |
|
|
BSONObj |
keyPattern, |
|
|
bool |
unique, |
|
|
const char * |
name | |
|
) |
| | [static] |
| static bool mongo::Helpers::findById |
( |
Client & |
, |
|
|
const char * |
ns, |
|
|
BSONObj |
query, |
|
|
BSONObj & |
result, |
|
|
bool * |
nsFound = 0, |
|
|
bool * |
indexFound = 0 | |
|
) |
| | [static] |
- Parameters:
-
| foundIndex | if passed in will be set to 1 if ns and index found |
- Returns:
- true if object found
| static DiskLoc mongo::Helpers::findOne |
( |
const char * |
ns, |
|
|
const BSONObj & |
query, |
|
|
bool |
requireIndex | |
|
) |
| | [static] |
| static bool mongo::Helpers::findOne |
( |
const char * |
ns, |
|
|
const BSONObj & |
query, |
|
|
BSONObj & |
result, |
|
|
bool |
requireIndex = false | |
|
) |
| | [static] |
| static bool mongo::Helpers::getFirst |
( |
const char * |
ns, |
|
|
BSONObj & |
result | |
|
) |
| | [inline, static] |
| static bool mongo::Helpers::getLast |
( |
const char * |
ns, |
|
|
BSONObj & |
result | |
|
) |
| | [static] |
| static bool mongo::Helpers::getSingleton |
( |
const char * |
ns, |
|
|
BSONObj & |
result | |
|
) |
| | [static] |
Get/put the first (or last) object from a collection. Generally only useful if the collection only ever has a single object -- which is a "singleton collection".
You do not need to set the database (Context) before calling.
- Returns:
- true if object exists.
| static bool mongo::Helpers::isEmpty |
( |
const char * |
ns, |
|
|
bool |
doAuth = true | |
|
) |
| | [static] |
You do not need to set the database before calling.
- Returns:
- true if collection is empty.
| static void mongo::Helpers::putSingleton |
( |
const char * |
ns, |
|
|
BSONObj |
obj | |
|
) |
| | [static] |
| static void mongo::Helpers::putSingletonGod |
( |
const char * |
ns, |
|
|
BSONObj |
obj, |
|
|
bool |
logTheOp | |
|
) |
| | [static] |
| static long long mongo::Helpers::removeRange |
( |
const string & |
ns, |
|
|
const BSONObj & |
min, |
|
|
const BSONObj & |
max, |
|
|
bool |
yield = false, |
|
|
bool |
maxInclusive = false, |
|
|
RemoveCallback * |
callback = 0 | |
|
) |
| | [static] |
| static void mongo::Helpers::upsert |
( |
const string & |
ns, |
|
|
const BSONObj & |
o | |
|
) |
| | [static] |
you have to lock you do not have to have Context set o has to have an _id field or will assert
The documentation for this struct was generated from the following file: