added core doc references
This commit is contained in:
parent
b4a95ac116
commit
98af49f465
|
@ -33,6 +33,8 @@ module Mongo
|
|||
# if collection name is not a string or symbol
|
||||
#
|
||||
# @return [Collection]
|
||||
#
|
||||
# @core collections constructor_details
|
||||
def initialize(db, name, pk_factory=nil)
|
||||
case name
|
||||
when Symbol, String
|
||||
|
@ -223,6 +225,8 @@ module Mongo
|
|||
# If true, check that the save succeeded. OperationFailure
|
||||
# will be raised on an error. Note that a safe check requires an extra
|
||||
# round-trip to the database.
|
||||
#
|
||||
# @core insert insert-instance_method
|
||||
def insert(doc_or_docs, options={})
|
||||
doc_or_docs = [doc_or_docs] unless doc_or_docs.is_a?(Array)
|
||||
doc_or_docs.collect! { |doc| @pk_factory.create_pk(doc) }
|
||||
|
@ -250,6 +254,8 @@ module Mongo
|
|||
#
|
||||
# @raise [Mongo::OperationFailure] an exception will be raised iff safe mode is enabled
|
||||
# and the operation fails.
|
||||
#
|
||||
# @core remove remove-instance_method
|
||||
def remove(selector={}, opts={})
|
||||
# Initial byte is 0.
|
||||
message = ByteBuffer.new([0, 0, 0, 0])
|
||||
|
@ -287,6 +293,8 @@ module Mongo
|
|||
# If true, check that the save succeeded. OperationFailure
|
||||
# will be raised on an error. Note that a safe check requires an extra
|
||||
# round-trip to the database.
|
||||
#
|
||||
# @core update update-instance_method
|
||||
def update(selector, document, options={})
|
||||
# Initial byte is 0.
|
||||
message = ByteBuffer.new([0, 0, 0, 0])
|
||||
|
@ -315,6 +323,8 @@ module Mongo
|
|||
# @param [Boolean] unique if true, this index will enforce a uniqueness constraint.
|
||||
#
|
||||
# @return [String] the name of the index created.
|
||||
#
|
||||
# @core indexes create_index-instance_method
|
||||
def create_index(field_or_spec, unique=false)
|
||||
field_h = OrderedHash.new
|
||||
if field_or_spec.is_a?(String) || field_or_spec.is_a?(Symbol)
|
||||
|
@ -335,11 +345,15 @@ module Mongo
|
|||
# Drop a specified index.
|
||||
#
|
||||
# @param [String] name
|
||||
#
|
||||
# @core indexes
|
||||
def drop_index(name)
|
||||
@db.drop_index(@name, name)
|
||||
end
|
||||
|
||||
# Drop all indexes.
|
||||
#
|
||||
# @core indexes
|
||||
def drop_indexes
|
||||
|
||||
# Note: calling drop_indexes with no args will drop them all.
|
||||
|
@ -371,6 +385,8 @@ module Mongo
|
|||
# @return [Collection] a collection containing the results of the operation.
|
||||
#
|
||||
# @see http://www.mongodb.org/display/DOCS/MapReduce Offical MongoDB map/reduce documentation.
|
||||
#
|
||||
# @core mapreduce map_reduce-instance_method
|
||||
def map_reduce(map, reduce, opts={})
|
||||
map = Code.new(map) unless map.is_a?(Code)
|
||||
reduce = Code.new(reduce) unless reduce.is_a?(Code)
|
||||
|
@ -564,6 +580,8 @@ EOS
|
|||
# Get information on the indexes for this collection.
|
||||
#
|
||||
# @return [Hash] a hash where the keys are index names.
|
||||
#
|
||||
# @core indexes
|
||||
def index_information
|
||||
@db.index_information(@name)
|
||||
end
|
||||
|
|
|
@ -85,6 +85,8 @@ module Mongo
|
|||
# :pool_size => 20, :timeout => 5)
|
||||
#
|
||||
# @see http://www.mongodb.org/display/DOCS/Replica+Pairs+in+Ruby Replica pairs in Ruby
|
||||
#
|
||||
# @core connections constructor_details
|
||||
def initialize(pair_or_host=nil, port=nil, options={})
|
||||
@nodes = format_pair(pair_or_host, port)
|
||||
|
||||
|
@ -145,6 +147,8 @@ module Mongo
|
|||
# @param [String] db_name a valid database name.
|
||||
#
|
||||
# @return [Mongo::DB]
|
||||
#
|
||||
# @core databases db-instance_method
|
||||
def db(db_name, options={})
|
||||
DB.new(db_name, self, options.merge(:logger => @logger))
|
||||
end
|
||||
|
@ -154,6 +158,8 @@ module Mongo
|
|||
# @param [String] db_name a valid database name.
|
||||
#
|
||||
# @return [Mongo::DB]
|
||||
#
|
||||
# @core databases []-instance_method
|
||||
def [](db_name)
|
||||
DB.new(db_name, self, :logger => @logger)
|
||||
end
|
||||
|
|
|
@ -29,6 +29,8 @@ module Mongo
|
|||
# similar methods. Application developers shouldn't have to create cursors manually.
|
||||
#
|
||||
# @return [Cursor]
|
||||
#
|
||||
# @core cursors constructor_details
|
||||
def initialize(collection, options={})
|
||||
@db = collection.db
|
||||
@collection = collection
|
||||
|
@ -131,6 +133,8 @@ module Mongo
|
|||
# @return [Integer] the current number_to_return if no parameter is given.
|
||||
#
|
||||
# @raise [InvalidOperation] if this cursor has already been used.
|
||||
#
|
||||
# @core limit limit-instance_method
|
||||
def limit(number_to_return=nil)
|
||||
return @limit unless number_to_return
|
||||
check_modifiable
|
||||
|
@ -200,6 +204,8 @@ module Mongo
|
|||
# Get the explain plan for this cursor.
|
||||
#
|
||||
# @return [Hash] a document containing the explain plan for this cursor.
|
||||
#
|
||||
# @core explain explain-instance_method
|
||||
def explain
|
||||
c = Cursor.new(@collection, query_options_hash.merge(:limit => -@limit.abs, :explain => true))
|
||||
explanation = c.next_document
|
||||
|
|
|
@ -62,6 +62,8 @@ module Mongo
|
|||
# which should take a hash and return a hash which merges the original hash with any primary key
|
||||
# fields the factory wishes to inject. (NOTE: if the object already has a primary key,
|
||||
# the factory should not inject a new key).
|
||||
#
|
||||
# @core databases constructor_details
|
||||
def initialize(db_name, connection, options={})
|
||||
@name = validate_db_name(db_name)
|
||||
@connection = connection
|
||||
|
@ -76,6 +78,8 @@ module Mongo
|
|||
# @param [String] password
|
||||
#
|
||||
# @return [Boolean]
|
||||
#
|
||||
# @core authenticate authenticate-instance_method
|
||||
def authenticate(username, password)
|
||||
doc = command(:getnonce => 1)
|
||||
raise "error retrieving nonce: #{doc}" unless ok?(doc)
|
||||
|
@ -415,6 +419,8 @@ module Mongo
|
|||
# @param [Socket] sock a socket to use. This is mainly for internal use.
|
||||
#
|
||||
# @return [Hash]
|
||||
#
|
||||
# @core commands command_instance-method
|
||||
def command(selector, admin=false, check_response=false, sock=nil)
|
||||
raise MongoArgumentError, "command must be given a selector" unless selector.is_a?(Hash) && !selector.empty?
|
||||
if selector.class.eql?(Hash) && selector.keys.length > 1
|
||||
|
@ -468,6 +474,8 @@ module Mongo
|
|||
# get the results using DB#profiling_info.
|
||||
#
|
||||
# @return [Symbol] :off, :slow_only, or :all
|
||||
#
|
||||
# @core profiling profiling_level-instance_method
|
||||
def profiling_level
|
||||
oh = OrderedHash.new
|
||||
oh[:profile] = -1
|
||||
|
|
|
@ -17,6 +17,9 @@ require 'mongo/gridfs/grid_store'
|
|||
|
||||
# GridFS is a specification for storing large binary objects in MongoDB.
|
||||
# See the documentation for GridFS::GridStore
|
||||
#
|
||||
# @see GridFS::GridStore
|
||||
#
|
||||
# @core gridfs
|
||||
module GridFS
|
||||
end
|
||||
|
|
|
@ -46,6 +46,8 @@ module GridFS
|
|||
# GridStore.open(database, 'filename', 'r') do |f|
|
||||
# puts f.read
|
||||
# end
|
||||
#
|
||||
# @core gridfs
|
||||
class GridStore
|
||||
|
||||
DEFAULT_ROOT_COLLECTION = 'fs'
|
||||
|
|
|
@ -25,6 +25,8 @@ module Mongo
|
|||
#
|
||||
# @param [String] a collection name
|
||||
# @param [ObjectID] an object id
|
||||
#
|
||||
# @core dbrefs constructor_details
|
||||
def initialize(namespace, object_id)
|
||||
@namespace = namespace
|
||||
@object_id = object_id
|
||||
|
|
|
@ -21,6 +21,8 @@ require 'digest/md5'
|
|||
module Mongo
|
||||
|
||||
# ObjectID class for documents in MongoDB.
|
||||
#
|
||||
# @core objectids
|
||||
class ObjectID
|
||||
# This is the legacy byte ordering for Babble. Versions of the Ruby
|
||||
# driver prior to 0.14 used this byte ordering when converting ObjectID
|
||||
|
|
Loading…
Reference in New Issue