Keine Cache-Version


Caching deaktiviert Standardeinstellung für diese Seite:aktiviert (code LNG204)
Wenn die Anzeige zu langsam ist, können Sie den Benutzermodus deaktivieren, um die zwischengespeicherte Version anzuzeigen.

Rechercher une fonction PHP

The MongoDB class

(PECL mongo >=0.9.0)

Einführung

Instances of this class are used to interact with a database. To get a database:

Beispiel #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 "$".

Erste Seite von PHP-Handbuch Inhaltsverzeichnis Haut

Klassenbeschreibung

MongoDB {
/* Konstanten */
const int PROFILING_OFF = 0 ;
const int PROFILING_SLOW = 1 ;
const int PROFILING_ON = 2 ;
/* Fields */
public integer $w = 1 ;
public integer $wtimeout = 10000 ;
/* Methoden */
public authenticate ( string $username , string $password ) : array
public command ( array $command [, array $options = array() [, string &$hash ]] ) : array
public __construct ( MongoClient $conn , string $name )
public createCollection ( string $name [, array $options ] ) : MongoCollection
public createDBRef ( string $collection , mixed $document_or_id ) : array
public drop ( void ) : array
public dropCollection ( mixed $coll ) : array
public execute ( mixed $code [, array $args = array() ] ) : array
public forceError ( void ) : bool
public __get ( string $name ) : MongoCollection
public getCollectionInfo ([ array $options = array() ] ) : array
public getCollectionNames ([ array $options = array() ] ) : array
public getDBRef ( array $ref ) : array
public getGridFS ([ string $prefix = "fs" ] ) : MongoGridFS
public getProfilingLevel ( void ) : int
public getReadPreference ( void ) : array
public getSlaveOkay ( void ) : bool
public getWriteConcern ( void ) : array
public lastError ( void ) : array
public listCollections ([ array $options = array() ] ) : array
public prevError ( void ) : array
public repair ([ bool $preserve_cloned_files = FALSE [, bool $backup_original_files = FALSE ]] ) : array
public resetError ( void ) : array
public selectCollection ( string $name ) : MongoCollection
public setProfilingLevel ( int $level ) : int
public setReadPreference ( string $read_preference [, array $tags ] ) : bool
public setSlaveOkay ([ bool $ok = TRUE ] ) : bool
public setWriteConcern ( mixed $w [, int $wtimeout ] ) : bool
public __toString ( void ) : string
}

Erste Seite von PHP-Handbuch Inhaltsverzeichnis Haut

Vordefinierte Konstanten

Erste Seite von PHP-Handbuch Inhaltsverzeichnis Haut

MongoDB Log Levels

MongoDB::PROFILING_OFF
Profiling is off.
MongoDB::PROFILING_SLOW
Profiling is on for slow operations (>100 ms).
MongoDB::PROFILING_ON
Profiling is on for all operations.

Erste Seite von PHP-Handbuch Inhaltsverzeichnis Haut

Fields

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 whenever you need to adjust the acknowledgement level (MongoCollection::insert(), MongoCollection::update(), MongoCollection::remove(), MongoCollection::save(), and MongoCollection::ensureIndex() 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).

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.

Erste Seite von PHP-Handbuch Inhaltsverzeichnis Haut

Inhaltsverzeichnis

Finde eine PHP-Funktion

Deutsche Übersetzung

Sie haben gebeten, diese Seite auf Deutsch zu besuchen. Momentan ist nur die Oberfläche übersetzt, aber noch nicht der gesamte Inhalt.

Wenn Sie mir bei Übersetzungen helfen wollen, ist Ihr Beitrag willkommen. Alles, was Sie tun müssen, ist, sich auf der Website zu registrieren und mir eine Nachricht zu schicken, in der Sie gebeten werden, Sie der Gruppe der Übersetzer hinzuzufügen, die Ihnen die Möglichkeit gibt, die gewünschten Seiten zu übersetzen. Ein Link am Ende jeder übersetzten Seite zeigt an, dass Sie der Übersetzer sind und einen Link zu Ihrem Profil haben.

Vielen Dank im Voraus.

Dokument erstellt 30/01/2003, zuletzt geändert 26/10/2018
Quelle des gedruckten Dokuments:https://www.gaudry.be/de/php-rf-class.mongodb.html

Die Infobro ist eine persönliche Seite, deren Inhalt in meiner alleinigen Verantwortung liegt. Der Text ist unter der CreativeCommons-Lizenz (BY-NC-SA) verfügbar. Weitere Informationen auf die Nutzungsbedingungen und dem Autor.

Referenzen

  1. Zeigen Sie - html-Dokument Sprache des Dokuments:fr Manuel PHP : http://php.net

Diese Verweise und Links verweisen auf Dokumente, die während des Schreibens dieser Seite konsultiert wurden, oder die zusätzliche Informationen liefern können, aber die Autoren dieser Quellen können nicht für den Inhalt dieser Seite verantwortlich gemacht werden.
Der Autor Diese Website ist allein dafür verantwortlich, wie die verschiedenen Konzepte und Freiheiten, die mit den Nachschlagewerken gemacht werden, hier dargestellt werden. Denken Sie daran, dass Sie mehrere Quellinformationen austauschen müssen, um das Risiko von Fehlern zu reduzieren.

Inhaltsverzeichnis Haut