mongo Namespace Reference

tools for working in parallel/sharded/clustered environment More...

Classes

class  PoolForHost
 not thread safe thread safety is handled by DBConnectionPool More...
class  DBConnectionHook
class  DBConnectionPool
 Database connection pool. More...
class  AScopedConnection
class  ScopedDbConnection
 Use to get a connection from the pool. More...
class  ConnectionString
 ConnectionString handles parsing different ways to connect to mongo and determining method samples: server server:port foo/server:port,server:port SET server,server,server SYNC. More...
class  Query
 Represents a Mongo query expression. More...
class  DBConnector
 interface that handles communication with the db More...
class  DBClientInterface
 The interface that any db connection should implement. More...
class  DBClientWithCommands
 DB "commands" Basically just invocations of connection. More...
class  DBClientBase
 abstract class that implements the core db operations More...
class  ConnectException
class  DBClientConnection
 A basic connection to the database. More...
class  ReplicaSetMonitor
 manages state about a replica set for client keeps tabs on whose master and what slaves are up can hand a slave to someone for SLAVE_OK one instace per process per replica set TODO: we might be able to use a regular Node * to avoid _lock More...
class  DBClientReplicaSet
 Use this class to connect to a replica set of servers. More...
class  DBClientCursorInterface
 for mock purposes only -- do not create variants of DBClientCursor, nor hang code here More...
class  DBClientCursor
 Queries return a cursor object. More...
class  DBClientCursorBatchIterator
 iterate over objects in current batch only - will not cause a network call More...
class  DBClientMockCursor
class  LockException
 Exception class to encapsulate exceptions while managing distributed locks. More...
class  TimeNotFoundException
 Indicates an error in retrieving time values from remote servers. More...
class  DistributedLock
 The distributed lock is a configdb backed way of synchronizing system-wide tasks. More...
class  dist_lock_try
class  GridFSChunk
class  GridFS
 GridFS is for storing large file-style objects in MongoDB. More...
class  GridFile
 wrapper for a file stored in the Mongo database More...
class  Model
 Model is a base class for defining objects which are serializable to the Mongo database via the database driver. More...
class  ServerAndQuery
 holder for a server address and a query to run More...
class  ClusteredCursor
 this is a cursor that works over a set of servers can be used in serial/paralellel as controlled by sub classes More...
class  FilteringClientCursor
class  Servers
class  SerialServerClusteredCursor
 runs a query in serial across any number of servers returns all results from 1 server, then the next, etc. More...
class  ParallelSortClusteredCursor
 runs a query in parellel across N servers sots More...
class  Future
 tools for doing asynchronous operations right now uses underlying sync network ops and uses another thread should be changed to use non-blocking io More...
class  SyncClusterConnection
 This is a connection to a cluster of servers that operate as one for super high durability. More...
class  UpdateNotTheSame
struct  BSONElementFieldNameCmp
class  BSONElement
 BSONElement represents an "element" in a BSONObj. More...
struct  BSONElementCmpWithoutField
class  BSONObjCmp
struct  GENOIDLabeler
struct  DateNowLabeler
struct  MinKeyLabeler
struct  MaxKeyLabeler
class  Labeler
class  BSONObjBuilderValueStream
class  BSONSizeTracker
 used in conjuction with BSONObjBuilder, allows for proper buffer size to prevent crazy memory usage More...
class  BSONObj
 C++ representation of a "BSON" object -- that is, an extended JSON-style object in a binary representation. More...
struct  BSONArray
class  BSONFieldValue
class  BSONField
class  BSONObjBuilder
 Utility for creating a BSONObj. More...
class  BSONArrayBuilder
class  BSONObjIterator
 iterator for a BSONObj More...
class  BSONObjIteratorSorted
class  OID
 Object ID type. More...
class  Ordering
 A precomputation of a BSON index or sort key pattern. More...
class  StringData
 A StringData object wraps a 'const string&' or a 'const char*' without copying its contents. More...
struct  AtomicUInt
class  TrivialAllocator
class  StackAllocator
class  _BufBuilder
class  StackBufBuilder
 The StackBufBuilder builds smaller datasets on the stack instead of using malloc. More...
class  StringBuilder
 stringstream deals with locale so this is a lot faster than std::stringstream for UTF8 More...
struct  Date_t
class  AdminAccess
class  NoAdminAccess
class  AlignedBuilder
 a page-aligned BufBuilder. More...
class  FastArray
class  AssertionCount
struct  ExceptionInfo
class  ErrorMsg
 helper class that builds error strings. More...
class  DBException
class  AssertionException
class  UserException
class  MsgAssertionException
class  BackgroundJob
 Background thread dispatching. More...
class  PeriodicTask
 these run "roughly" every minute instantiate statically class MyTask : public PeriodicTask { public: virtual string name() const { return "MyTask; " } virtual void doWork() { log() << "hi" << endl; } } myTask; More...
class  BufReader
 helper to read and parse a block of memory methods throw the eof exception if the operation would pass the end of the buffer with which we are working. More...
struct  Checksum
 a simple, rather dumb, but very fast checksum. More...
class  List1
class  MutexDebugger
 only used on _DEBUG builds. More...
class  StaticObserver
class  mutex
 On pthread systems, it is an error to destroy a mutex while held (boost mutex may use pthread). More...
class  SimpleMutex
 The concept with SimpleMutex is that it is a basic lock/unlock with no special functionality (such as try and try timeout). More...
class  MVar
class  CodeBlock
class  RWLock
class  rwlock_try_write
 throws on failure to acquire in the specified time period. More...
class  rwlock_shared
class  rwlock
class  RWLockRecursive
 recursive on shared locks is ok for this implementation More...
class  SpinLock
 The spinlock currently requires late GCC support routines to be efficient. More...
class  scoped_spinlock
class  Notification
class  NotifyAll
 establishes a synchronization point between threads. More...
class  Guarded
 declare that a variable that is "guarded" by a mutex. More...
class  DiagStr
struct  _Ints
struct  _Chars
struct  _OWS
class  EmbeddedBuilder
class  FileInterface
class  File
class  FileAllocator
class  ThreadLocalValue
class  ProgressMeter
class  ProgressMeterHolder
class  TicketHolder
class  TicketHolderReleaser
class  ThreadSafeString
 this is a thread safe string you will never get a bad pointer, though data may be mungedd More...
struct  ptr
 A generic pointer type for function arguments. More...
class  HashTable
class  Histogram
 A histogram for a 32-bit integer range. More...
class  LabeledLevel
class  LazyString
class  LazyStringImpl
class  Tee
class  Nullstream
class  Logstream
struct  LogIndentLevel
class  LogFile
class  LRUishMap
class  MAdvise
class  MongoFile
class  MongoFileFinder
 look up a MMF by filename. More...
struct  MongoFileAllowWrites
class  MemoryMappedFile
struct  MoveableBuffer
 this is a sort of smart pointer class where we can move where something is and all the pointers will adjust. More...
struct  HostAndPort
 helper for manipulating host:port connection endpoints. More...
class  HttpClient
class  Listener
class  ElapsedTracker
 keep track of elapsed time after a set amount of time, tells you to do something only in this file because depends on Listener More...
class  ListeningSockets
struct  MSGHEADER
struct  OP_GETMORE
struct  MsgData
class  Message
class  AbstractMessagingPort
class  MessagingPort
class  MessageHandler
class  MessageServer
class  MiniWebServer
struct  SockAddr
 wrapped around os representation of network address More...
class  SocketException
 thrown by Socket and SockAddr More...
class  Socket
 thin wrapped around file descriptor and system calls todo: ssl More...
struct  ClockSkewException
class  OpTime
struct  PasswordValue
struct  RelativePath
 this is very much like a boost::path. More...
class  ProcessInfo
class  BlockingQueue
 simple blocking queue More...
class  RamLog
class  StringSplitter
class  Timer
 simple scoped timer More...
class  DevTimer
struct  UnitTest

Typedefs

typedef shared_ptr
< ReplicaSetMonitor
ReplicaSetMonitorPtr
typedef unsigned long long gridfs_offset
typedef map< string, BSONElementBSONMap
typedef set< BSONElement,
BSONElementFieldNameCmp
BSONSortedElements
typedef set< BSONObj, BSONObjCmpBSONObjSet
typedef set< BSONElement,
BSONElementCmpWithoutField
BSONElementSet
typedef multiset< BSONElement,
BSONElementCmpWithoutField
BSONElementMSet
typedef _BufBuilder
< TrivialAllocator
BufBuilder
typedef mutex::scoped_lock scoped_lock
typedef
boost::recursive_mutex::scoped_lock 
recursive_scoped_lock
typedef pthread_t threadId_t
 some self-testing of synchronization and attempts to catch race conditions.
typedef struct mongo::_IntsInts
typedef struct mongo::_CharsChars
typedef char CHARS [400]
typedef struct mongo::_OWSOWS
typedef uint64_t fileofs
typedef int HANDLE
typedef unsigned char md5digest [16]
typedef MemoryMappedFile MMF
typedef AtomicUInt MSGID
typedef int SOCKET
typedef unsigned long long ReplTime

Enumerations

enum  ResultFlagType { ResultFlag_CursorNotFound = 1, ResultFlag_ErrSet = 2, ResultFlag_ShardConfigStale = 4, ResultFlag_AwaitCapable = 8 }
enum  QueryOptions {
  QueryOption_CursorTailable = 1 << 1, QueryOption_SlaveOk = 1 << 2, QueryOption_OplogReplay = 1 << 3, QueryOption_NoCursorTimeout = 1 << 4,
  QueryOption_AwaitData = 1 << 5, QueryOption_Exhaust = 1 << 6, QueryOption_PartialResults = 1 << 7, QueryOption_AllSupported = QueryOption_CursorTailable | QueryOption_SlaveOk | QueryOption_OplogReplay | QueryOption_NoCursorTimeout | QueryOption_AwaitData | QueryOption_Exhaust | QueryOption_PartialResults
}
 

the query field 'options' can have these bits set:

More...
enum  UpdateOptions { UpdateOption_Upsert = 1 << 0, UpdateOption_Multi = 1 << 1, UpdateOption_Broadcast = 1 << 2 }
enum  RemoveOptions { RemoveOption_JustOne = 1 << 0, RemoveOption_Broadcast = 1 << 1 }
enum  InsertOptions { InsertOption_ContinueOnError = 1 << 0 }
 

need to put in DbMesssage::ReservedOptions as well

More...
enum  WriteConcern { W_NONE = 0, W_NORMAL = 1 }
 

controls how much a clients cares about writes default is NORMAL


enum  FieldCompareResult {
  LEFT_SUBFIELD = -2, LEFT_BEFORE = -1, SAME = 0, RIGHT_BEFORE = 1,
  RIGHT_SUBFIELD = 2
}
enum  BSONType {
  MinKey = -1, EOO = 0, NumberDouble = 1, String = 2,
  Object = 3, Array = 4, BinData = 5, Undefined = 6,
  jstOID = 7, Bool = 8, Date = 9, jstNULL = 10,
  RegEx = 11, DBRef = 12, Code = 13, Symbol = 14,
  CodeWScope = 15, NumberInt = 16, Timestamp = 17, NumberLong = 18,
  JSTypeMax = 18, MaxKey = 127
}
 

the complete list of valid BSON types see also bsonspec.org

More...
enum  BinDataType {
  BinDataGeneral = 0, Function = 1, ByteArrayDeprecated = 2, bdtUUID = 3,
  MD5Type = 5, bdtCustom = 128
}
enum  JsonStringFormat { Strict, TenGen, JS }
 

Formatting mode for generating JSON from BSON.

More...
enum  CommonErrorCodes { DatabaseDifferCaseCode = 13297, StaleConfigInContextCode = 13388 }
enum  { ASSERT_ID_DUPKEY = 11000 }
enum  { DEBUG_BUILD = 0 }
enum  LogLevel {
  LL_DEBUG, LL_INFO, LL_NOTICE, LL_WARNING,
  LL_ERROR, LL_SEVERE
}
enum  Operations {
  opReply = 1, dbMsg = 1000, dbUpdate = 2001, dbInsert = 2002,
  dbQuery = 2004, dbGetMore = 2005, dbDelete = 2006, dbKillCursors = 2007
}

Functions

void exitCleanly (ExitCode code)
void dbexit (ExitCode returnCode, const char *whyMsg, bool tryToGetLock)
bool inShutdown ()
void setupSignals ()
string getDbContext ()
bool haveLocalShardingInfo (const string &ns)
DBClientBasecreateDirectClient ()
string prettyHostName ()
void assembleRequest (const string &ns, BSONObj query, int nToReturn, int nToSkip, const BSONObj *fieldsToReturn, int queryOptions, Message &toSend)
BSONElement getErrField (const BSONObj &o)
bool hasErrField (const BSONObj &o)
bool serverAlive (const string &uri)
 pings server to check if it's up
string getDistLockProcess ()
string getDistLockId ()
BSONObj fromjson (const string &str)
 Create a BSONObj from a JSON <http://www.json.org> string.
BSONObj fromjson (const char *str, int *len=NULL)
 len will be size of JSON object in text chars.
bool isNaN (double d)
int compareElementValues (const BSONElement &l, const BSONElement &r)
void nested2dotted (BSONObjBuilder &b, const BSONObj &obj, const string &base="")
BSONObj nested2dotted (const BSONObj &obj)
void dotted2nested (BSONObjBuilder &b, const BSONObj &obj)
BSONObj dotted2nested (const BSONObj &obj)
BSONMap bson2map (const BSONObj &obj)
BSONSortedElements bson2set (const BSONObj &obj)
ostream & operator<< (ostream &s, const BSONObj &o)
ostream & operator<< (ostream &s, const BSONElement &e)
StringBuilderoperator<< (StringBuilder &s, const BSONObj &o)
StringBuilderoperator<< (StringBuilder &s, const BSONElement &e)
string escape (string s, bool escape_slash=false)
void assert (bool expr)
void uasserted (unsigned msgid, std::string s)
void uassert (unsigned msgid, std::string msg, bool expr)
void msgasserted (int msgid, const char *msg)
void msgasserted (int msgid, const std::string &msg)
void massert (unsigned msgid, std::string msg, bool expr)
int getGtLtOp (const BSONElement &e)
FieldCompareResult compareDottedFieldNames (const string &l, const string &r)
BSONObj OR (const BSONObj &a, const BSONObj &b)
BSONObj OR (const BSONObj &a, const BSONObj &b, const BSONObj &c)
BSONObj OR (const BSONObj &a, const BSONObj &b, const BSONObj &c, const BSONObj &d)
BSONObj OR (const BSONObj &a, const BSONObj &b, const BSONObj &c, const BSONObj &d, const BSONObj &e)
BSONObj OR (const BSONObj &a, const BSONObj &b, const BSONObj &c, const BSONObj &d, const BSONObj &e, const BSONObj &f)
bool fieldsMatch (const BSONObj &lhs, const BSONObj &rhs)
template<class L >
BSONObjBuilder_appendIt (BSONObjBuilder &_this, const StringData &fieldName, const L &vals)
void prefetch (void *p)
ostream & operator<< (ostream &s, const OID &o)
StringBuilderoperator<< (StringBuilder &s, const OID &o)
void time_t_to_String (time_t t, char *buf)
string time_t_to_String (time_t t=time(0))
string time_t_to_String_no_year (time_t t)
string time_t_to_String_short (time_t t)
int strnlen (const char *s, int n)
bool isNumber (char c)
unsigned stringToNum (const char *str)
 BOOST_STATIC_ASSERT (sizeof(void *)==sizeof(size_t))
void * ourmalloc (size_t size)
void * ourrealloc (void *ptr, size_t size)
NOINLINE_DECL void wasserted (const char *msg, const char *file, unsigned line)
NOINLINE_DECL void asserted (const char *msg, const char *file, unsigned line)
NOINLINE_DECL void verifyFailed (int msgid)
void uassert_nothrow (const char *msg)
 reported via lasterror, but don't throw exception
NOINLINE_DECL void uasserted (int msgid, const char *msg) MONGO_NORETURN
 a "user assertion".
NOINLINE_DECL void msgassertedNoTrace (int msgid, const char *msg) MONGO_NORETURN
 msgassert and massert are for errors that are internal but have a well defined error text string.
NOINLINE_DECL void streamNotGood (int code, string msg, std::ios &myios)
string errnoWithPrefix (const char *prefix)
 output the error # and error message with prefix.
string demangleName (const type_info &typeinfo)
void uasserted (int msgid, string msg)
void msgassertedNoTrace (int msgid, const string &msg)
void msgasserted (int msgid, string msg)
string causedBy (const char *e)
string causedBy (const DBException &e)
string causedBy (const std::exception &e)
string causedBy (const string &e)
void verify (int msgid, bool testOK)
 in the mongodb source, use verify() instead of assert().
void assertStreamGood (unsigned msgid, string msg, std::ios &myios)
template<typename T >
void bsonArrToNumVector (BSONElement el, vector< T > &results)
void rawCompress (const char *input, size_t input_length, char *compressed, size_t *compressed_length)
size_t maxCompressedLength (size_t source_len)
size_t compress (const char *input, size_t input_length, std::string *output)
bool uncompress (const char *compressed, size_t compressed_length, std::string *uncompressed)
void printStackTrace (ostream &o)
boost::xtime incxtimemillis (long long s)
void setupSIGTRAPforGDB ()
void breakpoint ()
void breakif (bool test)
boost::filesystem::path ensureParentDirCreated (const boost::filesystem::path &p)
 like "mkdir -p" but on parent dir of p rather than p itself
string makeTempFileName (path root)
string hexdump (const char *data, unsigned len)
unsigned setThreadName (const char *name)
string getThreadName ()
template<class T >
string ToString (const T &t)
pthread_t GetCurrentThreadId ()
bool isPrime (int n)
int nextPrime (int n)
void dumpmemory (const char *data, int len)
bool startsWith (const char *str, const char *prefix)
bool startsWith (string s, string p)
bool endsWith (const char *p, const char *suffix)
unsigned long swapEndian (unsigned long x)
unsigned long fixEndian (unsigned long x)
void strcpy_s (char *dst, unsigned len, const char *src)
ostream & operator<< (ostream &s, const ThreadSafeString &o)
int fromHex (char c)
char fromHex (const char *c)
string toHex (const void *inRaw, int len)
string toHexLower (const void *inRaw, int len)
void initLogging (const string &logpath, bool append)
 log to a file rather than stdout defined in assert_util.cpp
void rotateLogs (int signal)
const char * logLevelToString (LogLevel l)
Nullstreamout (int level=0)
void logflush (int level=0)
Nullstream_log (int level=0)
Nullstreamtlog (int level=0)
 logging which we may not want during unit tests (dbtests) runs.
Nullstreamlog (int level)
Nullstreamlog (LogLevel l)
Nullstreamlog (const LabeledLevel &ll)
Nullstreamlog ()
Nullstreamerror ()
Nullstreamwarning ()
Nullstreamproblem (int level=0)
std::string toUtf8String (const std::wstring &wide)
string errnoWithDescription (int x=errno)
void md5 (const void *buf, int nbytes, md5digest digest)
void md5 (const char *str, md5digest digest)
std::string digestToString (md5digest digest)
std::string md5simpledigest (const void *buf, int nbytes)
std::string md5simpledigest (string s)
void nullFunc ()
void checkTicketNumbers ()
vector< SockAddripToAddrs (const char *ips, int port, bool useUnixSockets)
int getMaxConnections ()
MSGID nextMessageId ()
bool doesOpGetAResponse (int op)
const char * opToString (int op)
bool opIsWrite (int op)
MessageServercreateServer (const MessageServer::Options &opts, MessageHandler *handler)
void enableIPv6 (bool state)
bool IPv6Enabled ()
void setSockTimeouts (int sock, double secs)
void disableNagle (int sock)
string getAddrInfoStrError (int code)
string hostbyname (const char *hostname)
string getHostName ()
 this is not cache and does a syscall
string getHostNameCached ()
 this is cached, so if changes during the process lifetime will be stale
void closesocket (int s)
string makeUnixSockPath (int port)
string askPassword ()
dev_t getPartition (const string &path)
bool onSamePartition (const string &path1, const string &path2)
void flushMyDirectory (const boost::filesystem::path &file)
void writePidFile (const string &path)
void printMemInfo (const char *where)
void writePidFile (const std::string &path)
int _wconvertmtos (SIZE_T s)
void printStackAndExit (int signalNum)
 Obtains the log file handler and writes the current thread's stack trace to it.
void splitStringDelim (const string &str, vector< string > *res, char delim)
void joinStringDelim (const vector< string > &strs, string *res, char delim)
string tolowerString (const string &input)
int lexNumCmp (const char *s1, const char *s2)
 Non numeric characters are compared lexicographically; numeric substrings are compared numerically; dots separate ordered comparable subunits.
int leadingOnes (unsigned char c)
bool isValidUTF8 (const char *s)
bool isValidUTF8 (string s)
long long parseLL (const char *n)
void time_t_to_Struct (time_t t, struct tm *buf, bool local=false)
string terseCurrentTime (bool colonsOk=true)
string timeToISOString (time_t time)
boost::gregorian::date currentDate ()
bool toPointInTime (const string &str, boost::posix_time::ptime *timeOfDay)
void sleepsecs (int s)
void sleepmicros (long long s)
void sleepmillis (long long s)
void jsTimeVirtualSkew (long long skew)
long long getJSTimeVirtualSkew ()
void jsTimeVirtualThreadSkew (long long skew)
long long getJSTimeVirtualThreadSkew ()
Date_t jsTime ()
 Date_t is milliseconds since epoch.
unsigned curTimeMicros ()
 warning this will wrap
unsigned long long curTimeMicros64 ()
unsigned long long curTimeMillis64 ()
unsigned _setThreadName (const char *name)
const char * default_getcurns ()
void sayDbContext (const char *errmsg)
void rawOut (const string &s)
string mongodVersion ()
const char * gitVersion ()
void printGitVersion ()
string sysInfo ()
void printSysInfo ()
void show_warnings ()
int versionCmp (StringData rhs, StringData lhs)

Variables

CmdLine cmdLine
const char * curNs = "in client mode"
bool dbexitCalled = false
DBConnectionPool pool
mongo::PoolFlushCmd poolFlushCmd
mongo::PoolStats poolStatsCmd
const BSONObj getlasterrorcmdobj = fromjson("{getlasterror:1}")
const BSONObj getpreverrorcmdobj = fromjson("{getpreverror:1}")
BSONObj getnoncecmdobj = fromjson("{getnonce:1}")
BSONObj ismastercmdobj = fromjson("{\"ismaster\":1}")
BSONObj getprofilingcmdobj = fromjson("{\"profile\":-1}")
mongo::ReplicaSetMonitorWatcher replicaSetMonitorWatcher
ThreadLocalValue< string > distLockIds ("")
boost::once_flag _init = BOOST_ONCE_INIT
class mongo::DistributedLockPinger distLockPinger
mongo::TestDistLockWithSync testDistLockWithSyncCmd
mongo::TestDistLockWithSkew testDistLockWithSkewCmd
mongo::SkewClockCommand testSkewClockCommand
 Utility command to virtually skew the clock of a mongo server a particular amount.
const unsigned DEFAULT_CHUNK_SIZE = 256 * 1024
struct mongo::GENOIDLabeler GENOID
struct mongo::DateNowLabeler DATENOW
struct mongo::MinKeyLabeler MINKEY
struct mongo::MaxKeyLabeler MAXKEY
Labeler::Label GT
Labeler::Label GTE
Labeler::Label LT
Labeler::Label LTE
Labeler::Label NE
Labeler::Label SIZE
BSONObj maxKey
BSONObj minKey
const int BSONObjMaxUserSize = 16 * 1024 * 1024
const int BSONObjMaxInternalSize = BSONObjMaxUserSize + ( 16 * 1024 )
const int BufferMaxSize = 64 * 1024 * 1024
AssertionCount assertionCount
MutexDebuggermutexDebugger = *(new MutexDebugger())
int tlogLevel = 0
Nullstream nullstream
class mongo::LoggingManager loggingManager
int logLevel = 0
const char *(* getcurns )() = default_getcurns
Tee *const warnings = new RamLog("warnings")
mongo::LogfileTest __test
mutex mapViewMutex ("mapView")
ourbitset writable
unsigned long long mapped = 0
const int DEFAULT_MAX_CONN = 20000
const int MAX_MAX_CONN = 20000
TicketHolder connTicketHolder (DEFAULT_MAX_CONN)
MSGID NextMsgId
const int MsgDataHeaderSize = sizeof(MsgData) - 4
Ports & ports = *(new Ports())
SockAddr unknownAddress ("0.0.0.0", 0)
string _hostNameCached
boost::once_flag _hostNameCachedInitFlags = BOOST_ONCE_INIT
const int portSendFlags = 0
const int portRecvFlags = 0
const int SOCK_FAMILY_UNKNOWN_ERROR = 13078
const int INVALID_SOCKET = -1
string dbpath
class mongo::PidFileWiper pidFileWiper
mongo::TextUnitTest textUnitTest
long long jsTime_virtual_skew
boost::thread_specific_ptr
< long long > 
jsTime_virtual_thread_skew
boost::thread_specific_ptr
< string > 
_threadName
mongo::UtilTest utilTest
const char versionString [] = "1.9.2"
const BSONArray versionArray = _versionArray(versionString)
mongo::VersionCmpTest versionCmpTest
mongo::VersionArrayTest versionArrayTest

Detailed Description

tools for working in parallel/sharded/clustered environment

Copyright (C) 2009 10gen Inc.

Copyright (C) 2010 10gen Inc.

Copyright (C) 2008 10gen Inc.

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License, version 3, as published by the Free Software Foundation.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License, version 3, as published by the Free Software Foundation.

This program is distributed in the hope that it will be useful,b but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.


Typedef Documentation

typedef pthread_t mongo::threadId_t

some self-testing of synchronization and attempts to catch race conditions.

use something like:

CodeBlock myBlock;

void foo() { CodeBlock::Within w(myBlock); ... }

In _DEBUG builds, will (sometimes/maybe) fail if two threads are in the same code block at the same time. Also detects and disallows recursion.


Enumeration Type Documentation

the complete list of valid BSON types see also bsonspec.org

Enumerator:
MinKey 

smaller than all other types

EOO 

end of object

NumberDouble 

double precision floating point value

String 

character string, stored in utf8

Object 

an embedded object

Array 

an embedded array

BinData 

binary data

Undefined 

Undefined type.

jstOID 

ObjectId.

Bool 

boolean type

Date 

date type

jstNULL 

null type

RegEx 

regular expression, a pattern with options

DBRef 

deprecated / will be redesigned

Code 

deprecated / use CodeWScope

Symbol 

a programming language (e.g., Python) symbol

CodeWScope 

javascript code that can execute on the database server, with SavedContext

NumberInt 

32 bit signed integer

Timestamp 

Updated to a Date with value next OpTime on insert.

NumberLong 

64 bit integer

JSTypeMax 

max type that is not MaxKey

MaxKey 

larger than all other types

need to put in DbMesssage::ReservedOptions as well

Enumerator:
InsertOption_ContinueOnError 

With muli-insert keep processing inserts if one fails.

Formatting mode for generating JSON from BSON.

See <http://mongodb.onconfluence.com/display/DOCS/Mongo+Extended+JSON> for details.

Enumerator:
Strict 

strict RFC format

TenGen 

10gen format, which is close to JS format.

This form is understandable by javascript running inside the Mongo server via eval()

JS 

Javascript JSON compatible.

the query field 'options' can have these bits set:

Enumerator:
QueryOption_CursorTailable 

Tailable means cursor is not closed when the last data is retrieved.

rather, the cursor marks the final object's position. you can resume using the cursor later, from where it was located, if more data were received. Set on dbQuery and dbGetMore.

like any "latent cursor", the cursor may become invalid at some point -- for example if that final object it references were deleted. Thus, you should be prepared to requery if you get back ResultFlag_CursorNotFound.

QueryOption_SlaveOk 

allow query of replica slave.

normally these return an error except for namespace "local".

QueryOption_NoCursorTimeout 

The server normally times out idle cursors after an inactivy period to prevent excess memory uses Set this option to prevent that.

QueryOption_AwaitData 

Use with QueryOption_CursorTailable.

If we are at the end of the data, block for a while rather than returning no data. After a timeout period, we do return as normal.

QueryOption_Exhaust 

Stream the data down full blast in multiple "more" packages, on the assumption that the client will fully read all data queried.

Faster when you are pulling a lot of data and know you want to pull it all down. Note: it is not allowed to not read all the data unless you close the connection.

Use the query( boost::function<void(const BSONObj&)> f, ... ) version of the connection's query() method, and it will take care of all the details for you.

QueryOption_PartialResults 

When sharded, this means its ok to return partial results Usually we will fail a query if all required shards aren't up If this is set, it'll be a partial result set.

Enumerator:
RemoveOption_JustOne 

only delete one option

RemoveOption_Broadcast 

flag from mongo saying this update went everywhere

Enumerator:
UpdateOption_Upsert 

Upsert - that is, insert the item if no matching item is found.

UpdateOption_Multi 

Update multiple documents (if multiple documents match query expression).

(Default is update a single document and stop.)

UpdateOption_Broadcast 

flag from mongo saying this update went everywhere


Function Documentation

string mongo::errnoWithPrefix ( const char *  prefix  ) 

output the error # and error message with prefix.

handy for use as parm in uassert/massert.

BSONObj mongo::fromjson ( const char *  str,
int *  len = NULL 
)

len will be size of JSON object in text chars.

BSONObj mongo::fromjson ( const string &  str  ) 

Create a BSONObj from a JSON <http://www.json.org> string.

In addition to the JSON extensions extensions described here <http://mongodb.onconfluence.com/display/DOCS/Mongo+Extended+JSON>, this function accepts certain unquoted field names and allows single quotes to optionally be used when specifying field names and string values instead of double quotes. JSON unicode escape sequences (of the form ) are converted to utf8.

Exceptions:
MsgAssertionException if parsing fails. The message included with this assertion includes a rough indication of where parsing failed.
int mongo::lexNumCmp ( const char *  s1,
const char *  s2 
) [inline]

Non numeric characters are compared lexicographically; numeric substrings are compared numerically; dots separate ordered comparable subunits.

For convenience, character 255 is greater than anything else.

void mongo::msgassertedNoTrace ( int  msgid,
const char *  msg 
)

msgassert and massert are for errors that are internal but have a well defined error text string.

a stack trace is logged.

void mongo::printStackAndExit ( int  signalNum  ) 

Obtains the log file handler and writes the current thread's stack trace to it.

This call issues an exit(). The function can safely be called from within a signal handler.

Parameters:
signal that this hadler is called for
unsigned mongo::setThreadName ( const char *  name  ) 
Returns:
if this name has an increasing counter associated, return the value otherwise 0
Nullstream& mongo::tlog ( int  level = 0  )  [inline]

logging which we may not want during unit tests (dbtests) runs.

set tlogLevel to -1 to suppress tlog() output in a test program.

void mongo::uasserted ( int  msgid,
const char *  msg 
)

a "user assertion".

throws UserAssertion. logs. typically used for errors that a user could cause, such as duplicate key, disk full, etc.

void mongo::verify ( int  msgid,
bool  testOK 
) [inline]

in the mongodb source, use verify() instead of assert().

verify is always evaluated even in release builds.


Variable Documentation

mongo::SkewClockCommand mongo::testSkewClockCommand

Utility command to virtually skew the clock of a mongo server a particular amount.

This skews the clock globally, per-thread skew is also possible.

Generated on Wed Sep 14 01:46:41 2011 for MongoDB by  doxygen 1.6.3