# File lib/mongo/db.rb, line 279 def create_collection(name, opts={}) name = name.to_s if collection_names.include?(name) if strict? raise MongoDBError, "Collection #{name} already exists. " + "Currently in strict mode." else return Collection.new(name, self, opts) end end # Create a new collection. oh = BSON::OrderedHash.new oh[:create] = name doc = command(oh.merge(opts || {})) return Collection.new(name, self, :pk => @pk_factory) if ok?(doc) raise MongoDBError, "Error creating collection: #{doc.inspect}" end