Войти через VK Войти через FB Войти через Google Войти через Яндекс
Поиск по сайту
PHP Поиск
The MongoDB class
(Информация о версии неизвестна, возможно, только в SVN)
Введение
Instances of this class are used to interact with a database. To get a database:
$m = new Mongo(); // connect
$db = $m->selectDB("example");
Database names can use almost any character in the ASCII range. However, they cannot contain " ", "." or be the empty string. The name "system" is also reserved.
A few unusual, but valid, database names: "null", "[x,y]", "3", "\"", "/".
Unlike collection names, database names may contain "$".
Обзор классов
MongoDB {
/* Константы */
const int PROFILING_OFF = 0 ;
const int PROFILING_SLOW = 1 ;
const int PROFILING_ON = 2 ;
/* Fields */
public integer $MongoDB->w = 1 ;
public integer $wtimeout = 10000 ;
/* Методы */
public array MongoDB::authenticate ( string $username , string $password )
public array MongoDB::command ( array $command [, array $options = array() ] )
MongoDB::__construct ( Mongo $conn , string $name )
public MongoCollection MongoDB::createCollection ( string $name [, bool $capped = FALSE [, int $size = 0 [, int $max = 0 ]]] )
public array MongoDB::createDBRef ( string $collection , mixed $a )
public array MongoDB::drop ( void )
public array MongoDB::dropCollection ( mixed $coll )
public array MongoDB::execute ( mixed $code [, array $args = array() ] )
public bool MongoDB::forceError ( void )
public MongoCollection MongoDB::__get ( string $name )
public array MongoDB::getDBRef ( array $ref )
public MongoGridFS MongoDB::getGridFS ([ string $prefix = "fs" ] )
public int MongoDB::getProfilingLevel ( void )
public bool MongoDB::getSlaveOkay ( void )
public array MongoDB::lastError ( void )
public array MongoDB::listCollections ( void )
public array MongoDB::prevError ( void )
public array MongoDB::repair ([ bool $preserve_cloned_files = FALSE [, bool $backup_original_files = FALSE ]] )
public array MongoDB::resetError ( void )
public MongoCollection MongoDB::selectCollection ( string $name )
public int MongoDB::setProfilingLevel ( int $level )
public bool MongoDB::setSlaveOkay ([ bool $ok = true ] )
public string MongoDB::__toString ( void )
}
Предопределенные константы
MongoDB Log Levels
MongoDB::PROFILING_OFF
0 - Profiling is off.
MongoDB::PROFILING_SLOW
1 - Profiling is on for slow operations (>100 ms).
MongoDB::PROFILING_ON
2 - Profiling is on for all operations.
Fields
w
1 -
The number of servers to replicate a change to before returning success. Inherited by instances of MongoCollection derived from this. w functionality is only available in version 1.5.1+ of the MongoDB server and 1.0.8+ of the driver.
w is used whenever you perform a "safe" operation (MongoCollection::insert(), MongoCollection::update(), MongoCollection::remove(), MongoCollection::save(), and MongoCollection::ensureIndex() all support safe options). With the default value (1), a safe operation will return once the database server has the operation. If the server goes down before the operation has been replicated to a slave, it is possible to lose the operation forever. Thus, you can specify w to be higher than one and guarantee that at least one slave has the operation before it is considered successful.
For example, if w is 2, the main server and one slave must have a record of the operation or the driver will throw a MongoCursorException. It is tempting to set w to the total number of slaves + master, but then if one slave is down the op will fail and an exception will be thrown, so usually w=2 is safest (master+1 slave).
wtimeout
10000 -
The number of milliseconds to wait for MongoDB::$w replications to take place. Inherited by instances of MongoCollection derived from this. w functionality is only available in version 1.5.1+ of the MongoDB server and 1.0.8+ of the driver.
Unless wtimeout is set, the server waits forever for replicating to w servers to finish. The driver defaults to waiting for 10 seconds, you can change this value to alter its behavior.
Содержание
- MongoDB::authenticate — Log in to this database
- MongoDB::command — Execute a database command
- MongoDB::__construct — Creates a new database
- MongoDB::createCollection — Creates a collection
- MongoDB::createDBRef — Creates a database reference
- MongoDB::drop — Drops this database
- MongoDB::dropCollection — Drops a collection [deprecated]
- MongoDB::execute — Runs JavaScript code on the database server.
- MongoDB::forceError — Creates a database error
- MongoDB::__get — Gets a collection
- MongoDB::getDBRef — Fetches the document pointed to by a database reference
- MongoDB::getGridFS — Fetches toolkit for dealing with files stored in this database
- MongoDB::getProfilingLevel — Gets this database's profiling level
- MongoDB::getSlaveOkay — Get slaveOkay setting for this database
- MongoDB::lastError — Check if there was an error on the most recent db operation performed
- MongoDB::listCollections — Get a list of collections in this database
- MongoDB::prevError — Checks for the last error thrown during a database operation
- MongoDB::repair — Repairs and compacts this database
- MongoDB::resetError — Clears any flagged errors on the database
- MongoDB::selectCollection — Gets a collection
- MongoDB::setProfilingLevel — Sets this database's profiling level
- MongoDB::setSlaveOkay — Change slaveOkay setting for this database
- MongoDB::__toString — The name of this database
Смотрите также
MongoDB core docs on » databases.Описание класса mongodb, примеры использования класса mongodb.
Описание на ru2.php.netОписание на php.ru
.
Прокомментировать/Отблагодарить
Популярное:
- Анализ сайта
- Проверка email
- Чей IP-адрес?
- Чей домен?
- Где телефон?
- Генератор Sitemap
- Примеры Ajax
- Примеры PHP
- Примеры Javascript
- Примеры HTML, CSS
- Бесплатные прокси
- GEO-сервисы
- Сайт в ТОП (SEO)
- Полезные ссылки
- Генератор Robots.txt
Содержание:
- HTML
- Что такое HTML
- <!DOCTYPE>
- Мета теги в <head>
- Тег <base>
- Текст в html
- HTML списки
- Ссылки
- Картинки на сайте
- Таблицы
- Фреймы
- Формы
- DHTML
- Музыка
- Видео
- Карты изображений
- SVG карты
- Графика в HTML
- SSI .shtml
- Таблица цветов RGB
- Правильное
сочетание цветов - Таблица
«безопасных»
цветов - Таблица символов
- Примеры HTML, CSS
- CSS
- JavaScript
- PHP + MySQL
- Введение в PHP
- Основы языка
- Использование
массивов - $_server
- Создание функций
- Строки
- Функции работы
со строками - Объектное
программирование - Формы
- Файлы
- Загрузка файлов
на сервер - MySQL
- Cookie
- htaccess
- Безопасность
- Сессии
- Отправка почты
- Кэширование
- Дата, время
- Математические
функции - Дополнительные
возможности - Регулярные
выражения - Библиотека Curl
- IMAP, POP3, NNTP
- Оптимизация
- Примеры скриптов
- XML + XSLT
- AJAX
- Графика CorelDRAW
- SEO
- Сервисы
- Разное
- Движки сайтов (CMS)
- Регистрация
доменов и хостинг - Заработок для
web-мастеров - Хостинг
- Настройка DNS
- ADSL
- RSS
- ActiveX и HTML
- Паролирование
страницы - HTTP коды
- HTTP протокол
- HTTP заголовки
- Прячем ссылки
- ☠ Черный список
сайтов - ☭ Заработок
в интернете - Термины и
определения - Продажа доменов
- ✉ Настройки
Яндекс-почты - Кнопки социалок
- ☎ Настроки SIP
в телефоне - Создание
поискового плугина - Сервис
коротких ссылок - Telegram: бот, ссылки
- Шаблоны сайтов
- Друзья
- Задания к л/р
- Примеры
зачетных задач
- Статьи, обзоры
- Новости