You are here

function mongodb_default_write_options in MongoDB 7

Same name and namespace in other branches
  1. 6 mongodb.module \mongodb_default_write_options()

Returns default options for MongoDB write operations.

Parameters

bool $safe: Set it to FALSE for "fire and forget" write operation.

Return value

array Default options for Mongo write operations.

21 calls to mongodb_default_write_options()
Cache::__construct in mongodb_cache/mongodb_cache_plugin.php
Constructor.
drush_mongodb_migrate in mongodb_migrate/mongodb_migrate.drush.inc
Drush callback; migrate all field data into MongoDB.
MongoDBQueue::createItem in mongodb_queue/mongodb_queue.inc
Add a queue item and store it directly to the queue.
MongoDBQueue::deleteItem in mongodb_queue/mongodb_queue.inc
Delete a finished item from the queue.
MongoDBQueue::releaseItem in mongodb_queue/mongodb_queue.inc
Release an item that the worker could not process.

... See full list

File

./mongodb.module, line 402
Contains the main module connecting Drupal to MongoDB.

Code

function mongodb_default_write_options($safe = TRUE) {
  if ($safe) {
    if (version_compare(phpversion('mongo'), '1.5.0') == -1) {
      return array(
        'safe' => TRUE,
      );
    }
    else {
      return variable_get('mongodb_write_safe_options', array(
        'w' => 1,
      ));
    }
  }
  else {
    if (version_compare(phpversion('mongo'), '1.3.0') == -1) {
      return array();
    }
    else {
      return variable_get('mongodb_write_nonsafe_options', array(
        'w' => 0,
      ));
    }
  }
}