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.
157 158 159 160 161 162 163 164 165 166 167 168 169 170 |
# File 'lib/mongo/index/view.rb', line 157 def create_one(keys, = {}) = .dup = {} if session = @options[:session] [:session] = session end %i(commit_quorum session comment).each do |key| if value = .delete(key) [key] = value end end create_many({ key: keys }.merge(), ) end |