MongoDB\Driver\WriteConcern::__construct

(mongodb >=1.0.0)

MongoDB\Driver\WriteConcern::__constructCreate a new WriteConcern

Beschreibung

final public MongoDB\Driver\WriteConcern::__construct(string|int $w, int $wtimeout = ?, bool $journal = ?)

Constructs a new MongoDB\Driver\WriteConcern, which is an immutable value object.

Parameter-Liste

w

Write concern
Value Description
1 Requests acknowledgement that the write operation has propagated to the standalone mongod or the primary in a replica set. This is the default write concern for MongoDB.
0 Requests no acknowledgment of the write operation. However, this may return information about socket exceptions and networking errors to the application.
<integer greater than 1> Numbers greater than 1 are valid only for replica sets to request acknowledgement from specified number of members, including the primary.
MongoDB\Driver\WriteConcern::MAJORITY

Requests acknowledgment that write operations have propagated to the majority of voting nodes, including the primary, and have been written to the on-disk journal for these nodes.

Prior to MongoDB 3.0, this refers to the majority of replica set members (not just voting nodes).

string A string value is interpereted as a tag set. Requests acknowledgement that the write operations have propagated to a replica set member with the specified tag.

wtimeout

How long to wait (in milliseconds) for secondaries before failing.

wtimeout causes write operations to return with an error (WriteConcernError) after the specified limit, even if the required write concern will eventually succeed. When these write operations return, MongoDB does not undo successful data modifications performed before the write concern exceeded the wtimeout time limit.

If specified, wtimeout must be a signed 64-bit integer greater than or equal to zero.

Write concern timeout
Value Description
0 Block indefinitely. This is the default.
<integer greater than 0> Milliseconds to wait until returning.

journal

Wait until mongod has applied the write to the journal.

Fehler/Exceptions

Changelog

Version Beschreibung
PECL mongodb 1.7.0 The wTimeout parameter now accepts 64-bit values.

Beispiele

Beispiel #1 MongoDB\Driver\WriteConcern::__construct() example

<?php

/* Request write acknowledgement from the majority of the replica set nodes */
$wc = new MongoDB\Driver\WriteConcern(MongoDB\Driver\WriteConcern::MAJORITY500);

/* Request write acknowledgement from a node configured with the "MultipleDC" tag */
$wc = new MongoDB\Driver\WriteConcern("MultipleDC"500);

?>

Hier Kannst Du einen Kommentar verfassen


Bitte gib mindestens 10 Zeichen ein.
Wird geladen... Bitte warte.
* Pflichtangabe
Es sind noch keine Kommentare vorhanden.

PHP cURL-Tutorial: Verwendung von cURL zum Durchführen von HTTP-Anfragen

cURL ist eine leistungsstarke PHP-Erweiterung, die es Ihnen ermöglicht, mit verschiedenen Servern über verschiedene Protokolle wie HTTP, HTTPS, FTP und mehr zu kommunizieren. ...

TheMax

Autor : TheMax
Kategorie: PHP-Tutorials

Midjourney Tutorial - Anleitung für Anfänger

Über Midjourney, dem Tool zur Erstellung digitaler Bilder mithilfe von künstlicher Intelligenz, gibt es ein informatives Video mit dem Titel "Midjourney Tutorial auf Deutsch - Anleitung für Anfänger" ...

Mike94

Autor : Mike94
Kategorie: KI Tutorials

Grundlagen von Views in MySQL

Views in einer MySQL-Datenbank bieten die Möglichkeit, eine virtuelle Tabelle basierend auf dem Ergebnis einer SQL-Abfrage zu erstellen. ...

admin

Autor : admin
Kategorie: mySQL-Tutorials

Tutorial veröffentlichen

Tutorial veröffentlichen

Teile Dein Wissen mit anderen Entwicklern weltweit

Du bist Profi in deinem Bereich und möchtest dein Wissen teilen, dann melde dich jetzt an und teile es mit unserer PHP-Community

mehr erfahren

Tutorial veröffentlichen

Spielplan für 4 Gruppen zu je 6 Teams auf 2 Feldern

Hey, hallöchen! Du musst die Spiele so durchgehen, dass die Platzierung kontrolliert wechseln, dass jedes Team auf den Plätzen spielt. Hier ist ...

Geschrieben von derH0st am 10.06.2024 14:26:06
Forum: PHP Developer Forum
Does Google ignore common words?

Our website is optimized for "mock web services" and "web service mocks," but Google Webmaster doesn't recognize "web services" (or its variations ...

Geschrieben von TahuluLimia am 10.06.2024 12:26:02
Forum: Webmaster
How to overcome Safari's iframe cookie block?

Seeking an elegant solution for cross-domain cookie sharing in my project. Safari's default iframe session cookie block is a hurdle. While the san ...

Geschrieben von BrovtalGemini am 10.06.2024 10:14:21
Forum: HTML, JavaScript, AJAX, jQuery, CSS, Bootstrap, LESS
Helfen! Doppelte Bestelleinträge in meiner Verkaufstabelle

Identifizieren Sie doppelte Einträge: Manuelle Überprüfung: Durchsuchen Sie die Tabelle "Sales" nach doppelten Einträgen (zeitaufwändig & u ...

Geschrieben von LillianFelly am 04.06.2024 12:46:18
Forum: SQL / Datenbanken