Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions lib/mongo/collection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -518,8 +518,9 @@ def update(selector, document, opts={})
# @option opts [Boolean] :unique (false) if true, this index will enforce a uniqueness constraint.
# @option opts [Boolean] :background (false) indicate that the index should be built in the background. This
# feature is only available in MongoDB >= 1.3.2.
# @option opts [Boolean] :drop_dups (nil) If creating a unique index on a collection with pre-existing records,
# this option will keep the first document the database indexes and drop all subsequent with duplicate values.
# @option opts [Boolean] :drop_dups (nil) (DEPRECATED) If creating a unique index on a collection with
# pre-existing records, this option will keep the first document the database indexes and drop all subsequent
# with duplicate values.
# @option opts [Integer] :bucket_size (nil) For use with geoHaystack indexes. Number of documents to group
# together within a certain proximity to a given longitude and latitude.
# @option opts [Integer] :min (nil) specify the minimum longitude and latitude for a geo index.
Expand All @@ -545,6 +546,10 @@ def update(selector, document, opts={})
# @example A geospatial index with alternate longitude and latitude:
# @restaurants.create_index([['location', Mongo::GEO2D]], :min => 500, :max => 500)
#
# @note The :drop_dups option is no longer supported by MongoDB starting with server version 2.7.5.
# The option is silently ignored by the server and unique index builds using the option will
# fail if a duplicate value is detected.
#
# @return [String] the name of the index created.
def create_index(spec, opts={})
options = opts.dup
Expand Down Expand Up @@ -572,6 +577,10 @@ def create_index(spec, opts={})
# Time t+10min : @posts.ensure_index(:subject => Mongo::ASCENDING) -- calls create_index and
# resets the 5 minute counter
#
# @note The :drop_dups option is no longer supported by MongoDB starting with server version 2.7.5.
# The option is silently ignored by the server and unique index builds using the option will
# fail if a duplicate value is detected.
#
# @return [String] the name of the index.
def ensure_index(spec, opts={})
now = Time.now.utc.to_i
Expand Down