Geen cache-versie.


Caching uitgeschakeld. Standaardinstelling voor deze pagina:ingeschakeld (code LNG204)
Als het scherm te langzaam is, kunt u de gebruikersmodus uitschakelen om de cacheversie te bekijken.

Rechercher une fonction PHP

The MongoClient class

(PECL mongo >=1.3.0)

Warning

This extension that defines this class is deprecated. Instead, the MongoDB extension should be used. Alternatives to this class include:

Introduction

A connection manager for PHP and MongoDB.

This class is used to create and manage connections. A typical use is:

Example #1 MongoClient basic usage

<?php

$m 
= new MongoClient(); // connect
$db $m->foo// get the database named "foo"

?>

See MongoClient::__construct() and the section on connecting for more information about creating connections.

Eerste pagina van Manuel PHP  Inhoudsopgave Haut

Class synopsis

MongoClient {
/* Constants */
const string VERSION ;
const string DEFAULT_HOST = "localhost" ;
const int DEFAULT_PORT = 27017 ;
const string RP_PRIMARY = "primary" ;
const string RP_PRIMARY_PREFERRED = "primaryPreferred" ;
const string RP_SECONDARY = "secondary" ;
const string RP_SECONDARY_PREFERRED = "secondaryPreferred" ;
const string RP_NEAREST = "nearest" ;
/* Properties */
public boolean $connected = FALSE ;
public string $status = NULL ;
protected string $server = NULL ;
protected boolean $persistent = NULL ;
/* Methods */
public __construct ([ string $server = "mongodb://localhost:27017" [, array $options = array("connect" => TRUE) [, array $driver_options ]]] )
public close ([ boolean|string $connection ] ) : bool
public connect ( void ) : bool
public dropDB ( mixed $db ) : array
public __get ( string $dbname ) : MongoDB
public static getConnections ( void ) : array
public getHosts ( void ) : array
public getReadPreference ( void ) : array
public getWriteConcern ( void ) : array
public killCursor ( string $server_hash , int|MongoInt64 $id ) : bool
public listDBs ( void ) : array
public selectCollection ( string $db , string $collection ) : MongoCollection
public selectDB ( string $name ) : MongoDB
public setReadPreference ( string $read_preference [, array $tags ] ) : bool
public setWriteConcern ( mixed $w [, int $wtimeout ] ) : bool
public __toString ( void ) : string
}

Eerste pagina van Manuel PHP  Inhoudsopgave Haut

Predefined Constants

Eerste pagina van Manuel PHP  Inhoudsopgave Haut

MongoClient Constants

MongoClient::VERSION
PHP driver version. May be suffixed with "dev", "+" or "-" if it is in-between versions.
MongoClient::DEFAULT_HOST
Host to connect to if no host is given.
MongoClient::DEFAULT_PORT
Port to connect to if no port is given.
MongoClient::RP_PRIMARY
Read preference for the primary replica set member.
MongoClient::RP_PRIMARY_PREFERRED
Read preference for preferring the primary replica set member.
MongoClient::RP_SECONDARY
Read preference for a secondary replica set member.
MongoClient::RP_SECONDARY_PREFERRED
Read preference for preferring a secondary replica set member.
MongoClient::RP_NEAREST
Read preference for the nearest replica set member.

Eerste pagina van Manuel PHP  Inhoudsopgave Haut

Fields

connected

This property will be set to TRUE if we have a open connection to the database, FALSE otherwise. If the connection is to a replica set, this property will only be TRUE if the driver has a connection to a node matching the current read preference. This property does not take authentication into account.

This property is deprecated since version 1.5.0.

status

This property is no longer used and will be set to NULL In driver versions 1.1.x and earlier, this may be set to a string value (e.g. "recycled", "new") when persistent connections are used.

This property is deprecated since version 1.5.0.

Eerste pagina van Manuel PHP  Inhoudsopgave Haut

Table of Contents

Zoek een PHP-functie

Vertaling niet beschikbaar

De PHP-handleiding is nog niet in het Nederlands vertaald, dus het scherm is in het Engels. Als u wilt, kunt u het ook in het Frans of in het Duits raadplegen.

Als je de moed voelt, kun je je vertaling aanbieden ;-)

Nederlandse vertaling

U hebt gevraagd om deze site in het Nederlands te bezoeken. Voor nu wordt alleen de interface vertaald, maar nog niet alle inhoud.

Als je me wilt helpen met vertalingen, is je bijdrage welkom. Het enige dat u hoeft te doen, is u op de site registreren en mij een bericht sturen waarin u wordt gevraagd om u toe te voegen aan de groep vertalers, zodat u de gewenste pagina's kunt vertalen. Een link onderaan elke vertaalde pagina geeft aan dat u de vertaler bent en heeft een link naar uw profiel.

Bij voorbaat dank.

Document heeft de 30/01/2003 gemaakt, de laatste keer de 26/10/2018 gewijzigd
Bron van het afgedrukte document:https://www.gaudry.be/nl/php-rf-class.mongoclient.html

De infobrol is een persoonlijke site waarvan de inhoud uitsluitend mijn verantwoordelijkheid is. De tekst is beschikbaar onder CreativeCommons-licentie (BY-NC-SA). Meer info op de gebruiksvoorwaarden en de auteur.

Referenties

  1. Bekijk - html-document Taal van het document:fr Manuel PHP : http://php.net

Deze verwijzingen en links verwijzen naar documenten die geraadpleegd zijn tijdens het schrijven van deze pagina, of die aanvullende informatie kunnen geven, maar de auteurs van deze bronnen kunnen niet verantwoordelijk worden gehouden voor de inhoud van deze pagina.
De auteur Deze site is als enige verantwoordelijk voor de manier waarop de verschillende concepten, en de vrijheden die met de referentiewerken worden genomen, hier worden gepresenteerd. Vergeet niet dat u meerdere broninformatie moet doorgeven om het risico op fouten te verkleinen.

Inhoudsopgave Haut