Moodle PHP Documentation 4.1
Moodle 4.1.11 (Build: 20240610) (c8c84b4af18)
|
Namespaces | |
namespace | Command |
| |
namespace | Exception |
| |
namespace | GridFS |
| |
namespace | Model |
| |
namespace | Operation |
| |
Classes | |
class | BulkWriteResult |
class | ChangeStream |
class | Client |
class | Collection |
class | Database |
class | DeleteResult |
class | InsertManyResult |
class | InsertOneResult |
class | MapReduceResult |
class | UpdateResult |
Functions | |
all_servers_support_write_stage_on_secondary (array $servers) | |
apply_type_map_to_document ($document, array $typeMap) | |
Applies a type map to a document. | |
create_field_path_type_map (array $typeMap, string $fieldPath) | |
Creates a type map to apply to a field type. | |
extract_read_preference_from_options (array $options) | |
Returns the readPreference option if it is set and valid. | |
extract_session_from_options (array $options) | |
Returns the session option if it is set and valid. | |
generate_index_name ($document) | |
Generate an index name from a key specification. | |
get_encrypted_fields_from_driver (string $databaseName, string $collectionName, Manager $manager) | |
Return a collection's encryptedFields from the encryptedFieldsMap autoEncryption driver option (if available). | |
get_encrypted_fields_from_server (string $databaseName, string $collectionName, Manager $manager, Server $server) | |
Return a collection's encryptedFields option from the server (if any). | |
is_first_key_operator ($document) | |
Return whether the first key in the document starts with a "$" character. | |
is_in_transaction (array $options) | |
Returns whether we are currently in a transaction. | |
is_last_pipeline_operator_write (array $pipeline) | |
Return whether the aggregation pipeline ends with an $out or $merge operator. | |
is_mapreduce_output_inline ($out) | |
Return whether the "out" option for a mapReduce operation is "inline". | |
is_pipeline ($pipeline) | |
Returns whether an update specification is a valid aggregation pipeline. | |
is_string_array ($input) | |
Return whether the input is an array of strings. | |
is_write_concern_acknowledged (WriteConcern $writeConcern) | |
Return whether the write concern is acknowledged. | |
recursive_copy ($element) | |
Performs a deep copy of a value. | |
select_server (Manager $manager, array $options) | |
Performs server selection, respecting the readPreference and session options (if given) | |
select_server_for_aggregate_write_stage (Manager $manager, array &$options) | |
Performs server selection for an aggregate operation with a write stage. | |
server_supports_feature (Server $server, int $feature) | |
Return whether the server supports a particular feature. | |
with_transaction (Session $session, callable $callback, array $transactionOptions=[]) | |
Execute a callback within a transaction in the given session. | |
MongoDB\apply_type_map_to_document | ( | $document, | |
array | $typeMap ) |
Applies a type map to a document.
This function is used by operations where it is not possible to apply a type map to the cursor directly because the root document is a command response (e.g. findAndModify).
MongoDB\create_field_path_type_map | ( | array | $typeMap, |
string | $fieldPath ) |
Creates a type map to apply to a field type.
This is used in the Aggregate, Distinct, and FindAndModify operations to apply the root-level type map to the document that will be returned. It also replaces the root type with object for consistency within these operations
An existing type map for the given field path will not be overwritten
MongoDB\is_first_key_operator | ( | $document | ) |
Return whether the first key in the document starts with a "$" character.
This is used for differentiating update and replacement documents.
MongoDB\is_last_pipeline_operator_write | ( | array | $pipeline | ) |
Return whether the aggregation pipeline ends with an $out or $merge operator.
This is used for determining whether the aggregation pipeline must be executed against a primary server.
MongoDB\is_mapreduce_output_inline | ( | $out | ) |
Return whether the "out" option for a mapReduce operation is "inline".
This is used to determine if a mapReduce command requires a primary.
MongoDB\is_write_concern_acknowledged | ( | WriteConcern | $writeConcern | ) |
Return whether the write concern is acknowledged.
This function is similar to mongoc_write_concern_is_acknowledged but does not check the fsync option since that was never supported in the PHP driver.
MongoDB\recursive_copy | ( | $element | ) |
Performs a deep copy of a value.
This function will clone objects and recursively copy values within arrays.
MongoDB\select_server_for_aggregate_write_stage | ( | Manager | $manager, |
array & | $options ) |
Performs server selection for an aggregate operation with a write stage.
The $options parameter may be modified by reference if a primary read preference must be forced due to the existence of pre-5.0 servers in the topology.
MongoDB\with_transaction | ( | Session | $session, |
callable | $callback, | ||
array | $transactionOptions = [] ) |
Execute a callback within a transaction in the given session.
This helper takes care of retrying the commit operation or the entire transaction if an error occurs.
If the commit fails because of an UnknownTransactionCommitResult error, the commit is retried without re-invoking the callback. If the commit fails because of a TransientTransactionError, the entire transaction will be retried. In this case, the callback will be invoked again. It is important that the logic inside the callback is idempotent.
In case of failures, the commit or transaction are retried until 120 seconds from the initial call have elapsed. After that, no retries will happen and the helper will throw the last exception received from the driver.
Session | $session | A session object as retrieved by Client\startSession |
callable | $callback | A callback that will be invoked within the transaction |
array | $transactionOptions | Additional options that are passed to Session\startTransaction |
RuntimeException | for driver errors while committing the transaction |
Exception | for any other errors, including those thrown in the callback |