Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

mongoexception(3) [php man page]

MONGOEXCEPTION(3)							 1							 MONGOEXCEPTION(3)

The MongoException class

INTRODUCTION
Default Mongo exception. This covers a bunch of different error conditions that may eventually be moved to more specific exceptions, but will always extend Mon- goException. o The MongoSomething object has not been correctly initialized by its constructor Code: 0 Probably your Mongo object is not con- nected to a database server. o zero-length keys are not allowed, did you use $ with double quotes? Code: 1 You tried to save "" as a key. You generally should not do this. "" can mess up subobject access and is used by MongoDB internally. However, if you really want, you can set mongo.allow_empty_keys to true in your php.ini file to override this sanity check. If you override this, it is highly recommended that you set error checking to strict to avoid string interpolation errors. o '.' not allowed in key: <key> Code: 2 You attempted to write a key with '.' in it, which is prohibited. o insert too large: <size>, max: <max> Code: 3 You're attempting to send too much data to the database at once: the database will only accept inserts up to a certain size (currently 16 MB). o no elements in doc Code: 4 You're attempting to save a document with no fields. o size of BSON doc is <size> bytes, max <max>MB Code: 5 You're attempting to save a document that is larger than MongoDB can save. o no documents given Code: 6 You're attempting to batch insert an empty array of documents. o MongoCollection::group takes an array, object, or MongoCode key Code: 7 Wrong type parameter send to MongoCollection.group(3). o field names must be strings Code: 8 You should format field selectors as array("field1" => 1, "field2" => 1, ..., "fieldN" => 1). o invalid regex Code: 9 The regex passed to MongoRegex is not of the correct form. o MongoDBRef::get: $ref field must be a string Code: 10 o MongoDBRef::get: $db field must be a string Code: 11 o non-utf8 string: <str> Code: 12 This error occurs if you attempt to send a non-utf8 string to the database. All strings going into the database should be UTF8. See php.ini options for the transition option of quieting this exception. o mutex error: <err> Code: 13 The driver uses mutexes for synchronizing requests and responses in multithreaded environments. This is a fairly serious error and may not have a stack trace. It's unusual and should be reported to maintainers with any system information and steps to reproduce that you can provide. o index name too long: <len>, max <max> characters Code: 14 Indexes with names longer than 128 characters cannot be created. If you get this error, you should use MongoCollection.ensureIndex(3)'s "name" option to create a shorter name for your index. CLASS SYNOPSIS
MongoException MongoExceptionextends Exception PHP Documentation Group MONGOEXCEPTION(3)

Check Out this Related Man Page

MONGODB(3)								 1								MONGODB(3)

The MongoDB class

INTRODUCTION
Instances of this class are used to interact with a database. To get a database: Example #1 Selecting a database <?php $m = new MongoClient(); // connect $db = $m->selectDB("example"); ?> Database names can use almost any character in the ASCII range. However, they cannot contain " ", "." or be the empty string. The name "system" is also reserved. A few unusual, but valid, database names: "null", "[x,y]", "3", """, "/". Unlike collection names, database names may contain "$". CLASS SYNOPSIS
MongoDB MongoDB Constants o const int$MongoDB::PROFILING_OFF0 o const int$MongoDB::PROFILING_SLOW1 o const int$MongoDB::PROFILING_ON2 Fields o public integer$w1 o public integer$wtimeout10000 Methods o public array MongoDB::authenticate (string $username, string $password) o public array MongoDB::command (array $command, [array $options = array()], [string &$hash]) o public MongoDB::__construct (MongoClient $conn, string $name) o public MongoCollection MongoDB::createCollection (string $name, [array $options]) o public array MongoDB::createDBRef (string $collection, mixed $document_or_id) o public array MongoDB::drop (void ) o public array MongoDB::dropCollection (mixed $coll) o public array MongoDB::execute (mixed $code, [array $args = array()]) o public bool MongoDB::forceError (void ) o public MongoCollection MongoDB::__get (string $name) o public array MongoDB::getCollectionInfo ([array $options = array()]) o public array MongoDB::getCollectionNames ([array $options = array()]) o public array MongoDB::getDBRef (array $ref) o public MongoGridFS MongoDB::getGridFS ([string $prefix = "fs"]) o public int MongoDB::getProfilingLevel (void ) o public array MongoDB::getReadPreference (void ) o public bool MongoDB::getSlaveOkay (void ) o public array MongoDB::getWriteConcern (void ) o public array MongoDB::lastError (void ) o public array MongoDB::listCollections ([array $options = array()]) o public array MongoDB::prevError (void ) o public array MongoDB::repair FALSE FALSE ([bool $preserve_cloned_files], [bool $backup_original_files]) o public array MongoDB::resetError (void ) o public MongoCollection MongoDB::selectCollection (string $name) o public int MongoDB::setProfilingLevel (int $level) o public bool MongoDB::setReadPreference (string $read_preference, [array $tags]) o public bool MongoDB::setSlaveOkay ([bool $ok = true]) o public bool MongoDB::setWriteConcern (mixed $w, [int $wtimeout]) o public string MongoDB::__toString (void ) PREDEFINED CONSTANTS
MONGODB LOG LEVELS
o MongoDB::PROFILING_OFF - 0 - Profiling is off. o MongoDB::PROFILING_SLOW - 1 - Profiling is on for slow operations (>100 ms). o MongoDB::PROFILING_ON - 2 - Profiling is on for all operations. FIELDS
o $w -1 - The number of servers to replicate a change to before returning success. Inherited by instances of MongoCollection derived from this. w functionality is only available in version 1.5.1+ of the MongoDB server and 1.0.8+ of the driver. w is used when- ever you need to adjust the acknowledgement level (MongoCollection.insert(3), MongoCollection.update(3), MongoCollec- tion.remove(3), MongoCollection.save(3), and MongoCollection.ensureIndex(3) all support this option). With the default value (1), an acknowledged operation will return once the database server has the operation. If the server goes down before the operation has been replicated to a secondary, it is possible to lose the operation forever. Thus, you can specify w to be higher than one and guarantee that at least one secondary has the operation before it is considered successful. For example, if w is 2, the primary and one secondary must have a record of the operation or the driver will throw a MongoCursorException. It is tempting to set w to the total number of secondaries + primary, but then if one secondary is down the operation will fail and an exception will be thrown, so usually w=2 is safest (primary and one secondary). o $wtimeout -10000 - The number of milliseconds to wait for MongoDB::$w replications to take place. Inherited by instances of MongoCollection derived from this. w functionality is only available in version 1.5.1+ of the MongoDB server and 1.0.8+ of the driver. Unless wtimeout is set, the server waits forever for replicating to w servers to finish. The driver defaults to waiting for 10 seconds, you can change this value to alter its behavior. SEE ALSO
MongoDB core docs on databases. PHP Documentation Group MONGODB(3)
Man Page