DataMongoDB
in package
Table of Contents
Properties
- $_collections : mixed
- $_debug : mixed
- $_lastQuery : mixed
- $error : mixed
- $errorMsg : mixed
- $limit : mixed
- $page : mixed
- $sendSysLogs : mixed
- $uri : mixed
- $_client : Client
- $core : Core7
Methods
- __construct() : mixed
- addError() : bool
- Error Functions
- connect() : bool
- Stablish a connection with MONGODB
- deleteById() : array<string|int, mixed>|void
- Execute a deletion based on id https://docs.mongodb.com/php-library/current/reference/method/MongoDBCollection-deleteOne/
- find() : array<string|int, mixed>|void
- Execute a find action over a collection
- findIds() : array<string|int, mixed>|void
- Execute a find action over a collection and return only the keys
- getById() : array<string|int, mixed>|null
- Execute a find action over a $id
- getCollections() : array<string|int, mixed>|void
- Get the list of collections of a Mongo Database
- getDatabases() : array<string|int, mixed>|void
- Get the list of databases of a Mongo Conection
- getIndexes() : array<string|int, mixed>|void
- Execute a find action over a collection and return only the keys
- getLastQuery() : null|strig
- Return the last query value set in a find o update operation
- insertDocuments() : array<string|int, mixed>|void
- Execute an insertion of one or multiple documents https://docs.mongodb.com/php-library/current/reference/method/MongoDBCollection-insertOne/
- updateDocumentWithId() : array<string|int, mixed>|void
- Execute an update of one document. This document requires a _id field https://docs.mongodb.com/php-library/current/reference/method/MongoDBCollection-insertOne/
- connectWithCollection() : mixed|Collection
- Return a Collection to operate with
- prepareTypes() : void
- Transform _id fields and date contents into MongoDB objects
- transformTypes() : void
- Transform Mongo objects in arrays, strings , numbers
Properties
$_collections
public
mixed
$_collections
= []
$_debug
public
mixed
$_debug
= \false
$_lastQuery
public
mixed
$_lastQuery
= \null
$error
public
mixed
$error
= \false
$errorMsg
public
mixed
$errorMsg
= []
$limit
public
mixed
$limit
= 100
$page
public
mixed
$page
= 0
$sendSysLogs
public
mixed
$sendSysLogs
= \true
$uri
public
mixed
$uri
= ''
$_client
protected
Client
$_client
= \null
$core
protected
Core7
$core
Methods
__construct()
public
__construct(Core7 &$core[, mixed $uri = '' ]) : mixed
Parameters
- $core : Core7
- $uri : mixed = ''
addError()
Error Functions
public
addError(mixed $err) : bool
Parameters
- $err : mixed
Return values
boolconnect()
Stablish a connection with MONGODB
public
connect([mixed $uri = '' ]) : bool
Parameters
- $uri : mixed = ''
Return values
bool —True if connection is ok.
deleteById()
Execute a deletion based on id https://docs.mongodb.com/php-library/current/reference/method/MongoDBCollection-deleteOne/
public
deleteById( $db, $collection, mixed $id) : array<string|int, mixed>|void
Parameters
Return values
array<string|int, mixed>|voidfind()
Execute a find action over a collection
public
find( $db, $collection[, $filter = [] ][, array<string|int, mixed> $options = [] ]) : array<string|int, mixed>|void
Parameters
- $db :
- $collection :
- $filter : = []
- $options : array<string|int, mixed> = []
-
[projection=>array,sort=array,skip=>integer,limit=>integer,comment=>string,returnKey=>boolean,]. More info in https://docs.mongodb.com/php-library/current/reference/method/MongoDBCollection-find/
Return values
array<string|int, mixed>|voidfindIds()
Execute a find action over a collection and return only the keys
public
findIds( $db, $collection[, $filter = [] ][, array<string|int, mixed> $options = [] ]) : array<string|int, mixed>|void
Parameters
- $db :
- $collection :
- $filter : = []
- $options : array<string|int, mixed> = []
-
[sort=array,skip=>integer,limit=>integer,comment=>string,returnKey=>boolean,]. More info in https://docs.mongodb.com/php-library/current/reference/method/MongoDBCollection-find/
Return values
array<string|int, mixed>|voidgetById()
Execute a find action over a $id
public
getById( $db, $collection, $id) : array<string|int, mixed>|null
Parameters
Return values
array<string|int, mixed>|nullgetCollections()
Get the list of collections of a Mongo Database
public
getCollections(mixed $db) : array<string|int, mixed>|void
Parameters
- $db : mixed
Return values
array<string|int, mixed>|voidgetDatabases()
Get the list of databases of a Mongo Conection
public
getDatabases() : array<string|int, mixed>|void
Return values
array<string|int, mixed>|voidgetIndexes()
Execute a find action over a collection and return only the keys
public
getIndexes( $db, $collection) : array<string|int, mixed>|void
Parameters
Return values
array<string|int, mixed>|voidgetLastQuery()
Return the last query value set in a find o update operation
public
getLastQuery() : null|strig
Return values
null|striginsertDocuments()
Execute an insertion of one or multiple documents https://docs.mongodb.com/php-library/current/reference/method/MongoDBCollection-insertOne/
public
insertDocuments( $db, $collection, $documents) : array<string|int, mixed>|void
Parameters
Return values
array<string|int, mixed>|voidupdateDocumentWithId()
Execute an update of one document. This document requires a _id field https://docs.mongodb.com/php-library/current/reference/method/MongoDBCollection-insertOne/
public
updateDocumentWithId( $db, $collection, $update_info) : array<string|int, mixed>|void
Parameters
Return values
array<string|int, mixed>|voidconnectWithCollection()
Return a Collection to operate with
private
connectWithCollection( $db, $collection) : mixed|Collection
Parameters
Return values
mixed|CollectionprepareTypes()
Transform _id fields and date contents into MongoDB objects
private
prepareTypes(array<string|int, mixed> &$entity[, int $level = 0 ]) : void
Parameters
- $entity : array<string|int, mixed>
- $level : int = 0
transformTypes()
Transform Mongo objects in arrays, strings , numbers
private
transformTypes(array<string|int, mixed> &$entity[, int $level = 0 ]) : void
Parameters
- $entity : array<string|int, mixed>
- $level : int = 0