PHP Класс moadminModel, nodejs-autorestart

Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$colKeys array Array keys in the first and last object in a collection merged together (used to build sort-by options)
$count integer Number of rows in the entire resultset (before limit-clause is applied)
$mongo MongoDB MongoDB
$sort array Sort array - currently only used for collections
$totalDbSize integer Total size of all the databases

Защищенные свойства (Protected)

Свойство Тип Описание
$_db Mongo mongo connection - if a MongoDB object already exists (from a previous script) then only DB operations use this

Открытые методы

Метод Описание
__construct ( string $db = null ) Connects to a Mongo database if the name of one is supplied as an argument
createCollection ( string $collection ) Creates a collection
deleteIndex ( string $collection, array $index ) Removes an index
dropCollection ( string $collection ) Drops a collection
dropDb ( ) Drops a database
editObject ( string $collection, string $_id, string $idtype ) : array Retieves an object for editing
ensureIndex ( string $collection, array $indexes, array $unique ) Ensures an index
getStats ( ) : array Generate system info and stats
listCollections ( ) : array Gets a list of database collections
listDbs ( ) : array Gets list of databases
listIndexes ( string $collection ) : array Gets a list of the indexes on a collection
listRows ( string $collection ) : array Get the records in a collection
removeObject ( string $collection, string $_id, string $idtype ) Removes an object from a collection
repairDb ( ) : array Repairs a database
saveObject ( string $collection, string $obj ) : array Saves an object
setDb ( string $db ) Change the DB connection

Защищенные методы

Метод Описание
_exec ( string $cmd ) : mixed Executes a native JS MongoDB command This method is not currently used for anything
_mongo ( ) : Mongo Returns a new Mongo connection
_unserialize ( string $_id, string $idtype ) : mixed Returns a serialized element back to its native PHP form

Описание методов

__construct() публичный Метод

Connects to a Mongo database if the name of one is supplied as an argument
public __construct ( string $db = null )
$db string

_exec() защищенный Метод

Executes a native JS MongoDB command This method is not currently used for anything
protected _exec ( string $cmd ) : mixed
$cmd string
Результат mixed

_mongo() защищенный Метод

Returns a new Mongo connection
protected _mongo ( ) : Mongo
Результат Mongo

_unserialize() защищенный Метод

Returns a serialized element back to its native PHP form
protected _unserialize ( string $_id, string $idtype ) : mixed
$_id string
$idtype string
Результат mixed

createCollection() публичный Метод

Creates a collection
public createCollection ( string $collection )
$collection string

deleteIndex() публичный Метод

Removes an index
public deleteIndex ( string $collection, array $index )
$collection string
$index array Must match the array signature of the index

dropCollection() публичный Метод

Drops a collection
public dropCollection ( string $collection )
$collection string

dropDb() публичный Метод

Drops a database
public dropDb ( )

editObject() публичный Метод

Retieves an object for editing
public editObject ( string $collection, string $_id, string $idtype ) : array
$collection string
$_id string
$idtype string
Результат array

ensureIndex() публичный Метод

Ensures an index
public ensureIndex ( string $collection, array $indexes, array $unique )
$collection string
$indexes array
$unique array

getStats() публичный Метод

Generate system info and stats
public getStats ( ) : array
Результат array

listCollections() публичный Метод

Gets a list of database collections
public listCollections ( ) : array
Результат array

listDbs() публичный Метод

Gets list of databases
public listDbs ( ) : array
Результат array

listIndexes() публичный Метод

Gets a list of the indexes on a collection
public listIndexes ( string $collection ) : array
$collection string
Результат array

listRows() публичный Метод

Get the records in a collection
public listRows ( string $collection ) : array
$collection string
Результат array

removeObject() публичный Метод

Removes an object from a collection
public removeObject ( string $collection, string $_id, string $idtype )
$collection string
$_id string
$idtype string

repairDb() публичный Метод

Repairs a database
public repairDb ( ) : array
Результат array Success status

saveObject() публичный Метод

Saves an object
public saveObject ( string $collection, string $obj ) : array
$collection string
$obj string
Результат array

setDb() публичный Метод

Change the DB connection
public setDb ( string $db )
$db string

Описание свойств

$_db защищенное свойство

mongo connection - if a MongoDB object already exists (from a previous script) then only DB operations use this
protected Mongo $_db
Результат Mongo

$colKeys публичное свойство

Array keys in the first and last object in a collection merged together (used to build sort-by options)
public array $colKeys
Результат array

$count публичное свойство

Number of rows in the entire resultset (before limit-clause is applied)
public int $count
Результат integer

$mongo публичное свойство

MongoDB
public MongoDB $mongo
Результат MongoDB

$sort публичное свойство

Sort array - currently only used for collections
public array $sort
Результат array

$totalDbSize публичное свойство

Total size of all the databases
public int $totalDbSize
Результат integer