Method: Mongo::Index::View#create_one
- Defined in:
- lib/mongo/index/view.rb
#create_one(keys, options = {}) ⇒ Result
Note:
Note that the options listed may be subset of those available.
Creates an index on the collection.
See the MongoDB documentation for a full list of supported options by server version.
167 168 169 170 171 172 173 174 175 176 177 178 179 180 |
# File 'lib/mongo/index/view.rb', line 167 def create_one(keys, = {}) = .dup = {} if session = @options[:session] [:session] = session end %i(commit_quorum session comment timeout_ms max_time_ms).each do |key| if value = .delete(key) [key] = value end end create_many({ key: keys }.merge(), ) end |