Module: Mongo

Defined in:
lib/jmongo/db.rb,
lib/jmongo/cursor.rb,
lib/jmongo/version.rb,
lib/jmongo/mongo/db.rb,
lib/jmongo/collection.rb,
lib/jmongo/connection.rb,
lib/jmongo/exceptions.rb,
lib/jmongo/mongo/mongo.rb,
lib/jmongo/mongo/utils.rb,
lib/jmongo/mongo/collection.rb,
lib/jmongo/mongo/connection.rb

Overview

Copyright © 2010 Guy Boertje

Defined Under Namespace

Modules: JavaImpl Classes: AuthenticationError, Collection, Connection, ConnectionError, ConnectionFailure, ConnectionTimeoutError, Cursor, DB, InvalidNSName, InvalidOperation, InvalidSortValueError, MongoArgumentError, MongoDBError, MongoRubyError, OperationFailure, OperationTimeout, ReplicaSetConnectionError, ServerVersion, TimeoutThread

Constant Summary collapse

VERSION =
'1.1.5'
MongoDBException =
Java::ComMongodb::MongoException
NetworkException =
Java::ComMongodb::MongoException::Network
DuplicateKeyException =
Java::ComMongodb::MongoException::DuplicateKey
ASCENDING =
1
DESCENDING =
-1
GEO2D =
'2d'
DEFAULT_MAX_BSON_SIZE =
1024 * 1024 * 4
REPLACE =
JMongo::MapReduceCommand::OutputType::REPLACE
MERGE =
JMongo::MapReduceCommand::OutputType::MERGE
REDUCE =
JMongo::MapReduceCommand::OutputType::REDUCE
INLINE =
JMongo::MapReduceCommand::OutputType::INLINE
MapReduceEnumHash =
{:replace => REPLACE, :merge => MERGE, :reduce => REDUCE, :inline => INLINE}
DEFAULT_BATCH_SIZE =
100
OP_REPLY =
1
OP_MSG =
1000
OP_UPDATE =
2001
OP_INSERT =
2002
OP_QUERY =
2004
OP_GET_MORE =
2005
OP_DELETE =
2006
OP_KILL_CURSORS =
2007
OP_QUERY_TAILABLE =
JMongo::Bytes::QUERYOPTION_TAILABLE
OP_QUERY_SLAVE_OK =
JMongo::Bytes::QUERYOPTION_SLAVEOK
OP_QUERY_OPLOG_REPLAY =
JMongo::Bytes::QUERYOPTION_OPLOGREPLAY
OP_QUERY_NO_CURSOR_TIMEOUT =
JMongo::Bytes::QUERYOPTION_NOTIMEOUT
OP_QUERY_AWAIT_DATA =
JMongo::Bytes::QUERYOPTION_AWAITDATA
OP_QUERY_EXHAUST =
JMongo::Bytes::QUERYOPTION_EXHAUST
REPLY_CURSOR_NOT_FOUND =
JMongo::Bytes::RESULTFLAG_CURSORNOTFOUND
REPLY_QUERY_FAILURE =
JMongo::Bytes::RESULTFLAG_ERRSET
REPLY_SHARD_CONFIG_STALE =
JMongo::Bytes::RESULTFLAG_SHARDCONFIGSTALE
REPLY_AWAIT_CAPABLE =
JMongo::Bytes::RESULTFLAG_AWAITCAPABLE

Class Method Summary collapse

Class Method Details

.logger(logger = nil) ⇒ Object



38
39
40
# File 'lib/jmongo/mongo/mongo.rb', line 38

def self.logger(logger=nil)
  logger ? @logger = logger : @logger
end

.result_ok?(result) ⇒ Boolean

Returns:

  • (Boolean)


42
43
44
# File 'lib/jmongo/mongo/mongo.rb', line 42

def self.result_ok?(result)
  result['ok'] == 1.0 || result['ok'] == true
end