- Full name:
\MongoHybrid\Client
protected \MongoHybrid\Mongo|\MongoHybrid\MongoLite $driver
public ?string $type
public __construct(string $server, array $options = [], array $driverOptions = []): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$server |
string | |
$options |
array | |
$driverOptions |
array |
public dropCollection(string $name, ?string $db = null): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$name |
string | |
$db |
?string |
public renameCollection(string $name, string $newname, ?string $db = null): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$name |
string | |
$newname |
string | |
$db |
?string |
public save(string $collection, array& $data): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$collection |
string | |
$data |
array |
public insert(string $collection, array& $doc): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$collection |
string | |
$doc |
array |
public findTerm(string $collection, string $term, array $options = []): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$collection |
string | |
$term |
string | |
$options |
array |
Get value for specific key
public getKey(string $collection, string $key, mixed $default = null): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$collection |
string | |
$key |
string | |
$default |
mixed |
Set value for specific key
public setKey(string $collection, string $key, mixed $value): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$collection |
string | |
$key |
string | |
$value |
mixed |
Delete Key(s)
public removeKey(string $collection, string $key): int
Parameters:
Parameter | Type | Description |
---|---|---|
$collection |
string | |
$key |
string |
Check if key exists
public keyExists(string $collection, string $key): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$collection |
string | @param string $collection |
$key |
string |
Increment value by x
public incrKey(string $collection, string $key, int $by = 1): int
Parameters:
Parameter | Type | Description |
---|---|---|
$collection |
string | |
$key |
string | |
$by |
int |
Decrement value by x
public decrKey(string $collection, string $key, int $by = 1): int
Parameters:
Parameter | Type | Description |
---|---|---|
$collection |
string | |
$key |
string | |
$by |
int |
Add item to a value (right)
public rpush(string $collection, string $key, mixed $value): int
Parameters:
Parameter | Type | Description |
---|---|---|
$collection |
string | @param string $collection |
$key |
string | |
$value |
mixed |
Add item to a value (left)
public lpush(string $collection, string $key, mixed $value): int
Parameters:
Parameter | Type | Description |
---|---|---|
$collection |
string | @param string $collection |
$key |
string | |
$value |
mixed |
Set the value of an element in a list by its index
public lset(string $collection, string $key, int $index, mixed $value): bool
Parameters:
Parameter | Type | Description |
---|---|---|
$collection |
string | |
$key |
string | |
$index |
int | |
$value |
mixed |
Get an element from a list by its index
public lindex(string $collection, string $key, int $index): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$collection |
string | |
$key |
string | |
$index |
int |
Set the string value of a hash field
public hset(string $collection, string $key, string $field, mixed $value): void
Parameters:
Parameter | Type | Description |
---|---|---|
$collection |
string | |
$key |
string | |
$field |
string | |
$value |
mixed |
Get the value of a hash field
public hget(string $collection, string $key, string $field, mixed $default = null): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$collection |
string | |
$key |
string | |
$field |
string | |
$default |
mixed |
Get all the fields and values in a hash
public hgetall(string $collection, string $key): array
Parameters:
Parameter | Type | Description |
---|---|---|
$collection |
string | |
$key |
string |
Determine if a hash field exists
public hexists(string $collection, string $key, string $field): bool
Parameters:
Parameter | Type | Description |
---|---|---|
$collection |
string | |
$key |
string | |
$field |
string |
Get all the fields in a hash
public hkeys(string $collection, string $key): array
Parameters:
Parameter | Type | Description |
---|---|---|
$collection |
string | |
$key |
string |
Get all the values in a hash
public hvals(string $collection, string $key): array
Parameters:
Parameter | Type | Description |
---|---|---|
$collection |
string | |
$key |
string |
Get the number of fields in a hash
public hlen(string $collection, string $key): int
Parameters:
Parameter | Type | Description |
---|---|---|
$collection |
string | |
$key |
string |
Delete one or more hash fields
public hdel(string $collection, string $key): int
Parameters:
Parameter | Type | Description |
---|---|---|
$collection |
string | |
$key |
string |
Increment the integer value of a hash field by the given number
public hincrby(string $collection, string $key, string $field, int $by = 1): int
Parameters:
Parameter | Type | Description |
---|---|---|
$collection |
string | |
$key |
string | |
$field |
string | |
$by |
int |
Get the values of all the given hash fields
public hmget(string $collection, string $key): array
Parameters:
Parameter | Type | Description |
---|---|---|
$collection |
string | |
$key |
string |
Set multiple hash fields to multiple values
public hmset(string $collection, string $key): void
Parameters:
Parameter | Type | Description |
---|---|---|
$collection |
string | |
$key |
string |
public __call(mixed $method, mixed $args): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$method |
mixed | |
$args |
mixed |