Movatterモバイル変換


[0]ホーム

URL:


PHP 8.5.0 Alpha 2 available for testing
    MongoDB\Driver\ReadPreference::bsonSerialize »
    « MongoDB\Driver\WriteConcern::isDefault

    The MongoDB\Driver\ReadPreference class

    (mongodb >=1.0.0)

    Introduction

    Class synopsis

    finalclassMongoDB\Driver\ReadPreferenceimplementsMongoDB\BSON\Serializable,Serializable {
    /* Constants */
    conststringPRIMARY = primary;
    conststringPRIMARY_PREFERRED = primaryPreferred;
    conststringSECONDARY = secondary;
    conststringSECONDARY_PREFERRED = secondaryPreferred;
    conststringNEAREST = nearest;
    /* Methods */
    finalpublicbsonSerialize():stdClass
    finalpublic__construct(string$mode,?array$tagSets =null,?array$options =null)
    finalpublicgetHedge():?object
    finalpublicgetMode():int
    finalpublicgetModeString():string
    finalpublicgetTagSets():array
    }

    Predefined Constants

    MongoDB\Driver\ReadPreference::PRIMARY

    All operations read from the current replica set primary. This is the default read preference for MongoDB.

    MongoDB\Driver\ReadPreference::PRIMARY_PREFERRED

    In most situations, operations read from the primary but if it is unavailable, operations read from secondary members.

    MongoDB\Driver\ReadPreference::SECONDARY

    All operations read from the secondary members of the replica set.

    MongoDB\Driver\ReadPreference::SECONDARY_PREFERRED

    In most situations, operations read from secondary members but if no secondary members are available, operations read from the primary.

    MongoDB\Driver\ReadPreference::NEAREST

    Operations read from member of the replica set with the least network latency, irrespective of the member's type.

    MongoDB\Driver\ReadPreference::NO_MAX_STALENESS

    The default value for the"maxStalenessSeconds" option is to specify no limit on maximum staleness, which means that the driver will not consider a secondary's lag when choosing where to direct a read operation.

    MongoDB\Driver\ReadPreference::SMALLEST_MAX_STALENESS_SECONDS

    The minimum value for the"maxStalenessSeconds" option is 90 seconds. The driver estimates secondaries' staleness by periodically checking the latest write date of each replica set member. Since these checks are infrequent, the staleness estimate is coarse. Thus, the driver cannot enforce a max staleness value of less than 90 seconds.

    Changelog

    VersionDescription
    PECL mongodb 2.0.0

    Removed theMongoDB\Driver\ReadPreference::RP_PRIMARY,MongoDB\Driver\ReadPreference::RP_PRIMARY_PREFERRED,MongoDB\Driver\ReadPreference::RP_SECONDARY,MongoDB\Driver\ReadPreference::RP_SECONDARY_PREFERRED, andMongoDB\Driver\ReadPreference::RP_NEAREST constants. ThegetMode() method was also removed.

    PECL mongodb 1.20.0

    Deprecated theMongoDB\Driver\ReadPreference::RP_PRIMARY,MongoDB\Driver\ReadPreference::RP_PRIMARY_PREFERRED,MongoDB\Driver\ReadPreference::RP_SECONDARY,MongoDB\Driver\ReadPreference::RP_SECONDARY_PREFERRED, andMongoDB\Driver\ReadPreference::RP_NEAREST constants.

    PECL mongodb 1.7.0

    Added theMongoDB\Driver\ReadPreference::PRIMARY,MongoDB\Driver\ReadPreference::PRIMARY_PREFERRED,MongoDB\Driver\ReadPreference::SECONDARY,MongoDB\Driver\ReadPreference::SECONDARY_PREFERRED, andMongoDB\Driver\ReadPreference::NEAREST constants.

    ImplementsSerializable.

    PECL mongodb 1.2.0

    Added theMongoDB\Driver\ReadPreference::NO_MAX_STALENESS andMongoDB\Driver\ReadPreference::SMALLEST_MAX_STALENESS_SECONDS constants.

    ImplementsMongoDB\BSON\Serializable.

    Table of Contents

    Found A Problem?

    Learn How To Improve This PageSubmit a Pull RequestReport a Bug
    add a note

    User Contributed Notes

    There are no user contributed notes for this page.
    To Top
    and to navigate •Enter to select •Esc to close
    PressEnter without selection to search using Google

    [8]ページ先頭

    ©2009-2025 Movatter.jp