def create(key, options = {})
      spec = options.merge(ns: namespace, key: key)
      spec[:name] ||= key.to_a.join("_")

      database.session.with(write: { w: 1 }) do |_s|
        _s[:"system.indexes"].insert(spec)
      end
    end
def create(key, options = {})
      spec = options.merge(ns: namespace, key: key)
      spec[:name] ||= key.to_a.join("_")

      database.session.with(write: { w: 1 }) do |_s|
        _s[:"system.indexes"].insert(spec)
      end
    end
Create an index unless it already exists.

 @example Without options
   session[:users].indexes.create(name: 1)
   session[:users].indexes[name: 1]
   # => {"v"=>1, "key"=>{"name"=>1}, "ns"=>"moped_test.users", "name"=>"name_1" }

 @example With options
   session[:users].indexes.create(
     { location: "2d", name: 1 },
     { unique: true, dropDups: true }
   )
   session[:users][location: "2d", name: 1]
   {"v"=>1,
     "key"=>{"location"=>"2d", "name"=>1},
     "unique"=>true,
     "ns"=>"moped_test.users",
     "dropDups"=>true,
     "name"=>"location_2d_name_1"}

 @param [ Hash ] key The index spec.
 @param [ Hash ] options The options for the index.

 @return [ Hash ] The index spec.

 @see http://www.mongodb.org/display/DOCS/Indexes#Indexes-CreationOptions

 @since 1.0.0