Skip to content

Latest commit

 

History

History
826 lines (336 loc) · 8.46 KB

Client.md

File metadata and controls

826 lines (336 loc) · 8.46 KB

Client

  • Full name: \MongoHybrid\Client

Properties

driver

protected \MongoHybrid\Mongo|\MongoHybrid\MongoLite $driver

type

public ?string $type

Methods

__construct

public __construct(string $server, array $options = [], array $driverOptions = []): mixed

Parameters:

Parameter Type Description
$server string
$options array
$driverOptions array

dropCollection

public dropCollection(string $name, ?string $db = null): mixed

Parameters:

Parameter Type Description
$name string
$db ?string

renameCollection

public renameCollection(string $name, string $newname, ?string $db = null): mixed

Parameters:

Parameter Type Description
$name string
$newname string
$db ?string

save

public save(string $collection, array& $data): mixed

Parameters:

Parameter Type Description
$collection string
$data array

insert

public insert(string $collection, array& $doc): mixed

Parameters:

Parameter Type Description
$collection string
$doc array

findTerm

public findTerm(string $collection, string $term, array $options = []): mixed

Parameters:

Parameter Type Description
$collection string
$term string
$options array

getKey

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

setKey

Set value for specific key

public setKey(string $collection, string $key, mixed $value): mixed

Parameters:

Parameter Type Description
$collection string
$key string
$value mixed

removeKey

Delete Key(s)

public removeKey(string $collection, string $key): int

Parameters:

Parameter Type Description
$collection string
$key string

keyExists

Check if key exists

public keyExists(string $collection, string $key): mixed

Parameters:

Parameter Type Description
$collection string @param string $collection
$key string

incrKey

Increment value by x

public incrKey(string $collection, string $key, int $by = 1): int

Parameters:

Parameter Type Description
$collection string
$key string
$by int

decrKey

Decrement value by x

public decrKey(string $collection, string $key, int $by = 1): int

Parameters:

Parameter Type Description
$collection string
$key string
$by int

rpush

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

lpush

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

lset

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

lindex

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

hset

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

hget

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

hgetall

Get all the fields and values in a hash

public hgetall(string $collection, string $key): array

Parameters:

Parameter Type Description
$collection string
$key string

hexists

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

hkeys

Get all the fields in a hash

public hkeys(string $collection, string $key): array

Parameters:

Parameter Type Description
$collection string
$key string

hvals

Get all the values in a hash

public hvals(string $collection, string $key): array

Parameters:

Parameter Type Description
$collection string
$key string

hlen

Get the number of fields in a hash

public hlen(string $collection, string $key): int

Parameters:

Parameter Type Description
$collection string
$key string

hdel

Delete one or more hash fields

public hdel(string $collection, string $key): int

Parameters:

Parameter Type Description
$collection string
$key string

hincrby

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

hmget

Get the values of all the given hash fields

public hmget(string $collection, string $key): array

Parameters:

Parameter Type Description
$collection string
$key string

hmset

Set multiple hash fields to multiple values

public hmset(string $collection, string $key): void

Parameters:

Parameter Type Description
$collection string
$key string

__call

public __call(mixed $method, mixed $args): mixed

Parameters:

Parameter Type Description
$method mixed
$args mixed