Godeps/_workspace/src/gopkg.in/mgo.v2/session.go
func (c *Collection) Create(info *CollectionInfo) error {
	cmd := make(bson.D, 0, 4)
	cmd = append(cmd, bson.DocElem{"create", c.Name})
	if info.Capped {
		if info.MaxBytes < 1 {
			return fmt.Errorf("Collection.Create: with Capped, MaxBytes must also be set")
		}
		cmd = append(cmd, bson.DocElem{"capped", true})
		cmd = append(cmd, bson.DocElem{"size", info.MaxBytes})
		if info.MaxDocs > 0 {
			cmd = append(cmd, bson.DocElem{"max", info.MaxDocs})
		}
	}
	if info.DisableIdIndex {
		cmd = append(cmd, bson.DocElem{"autoIndexId", false})
	}
	if info.ForceIdIndex {
		cmd = append(cmd, bson.DocElem{"autoIndexId", true})
	}
	return c.Database.Run(cmd, nil)
}
func (c *Collection) Create(info *CollectionInfo) error {
	cmd := make(bson.D, 0, 4)
	cmd = append(cmd, bson.DocElem{"create", c.Name})
	if info.Capped {
		if info.MaxBytes < 1 {
			return fmt.Errorf("Collection.Create: with Capped, MaxBytes must also be set")
		}
		cmd = append(cmd, bson.DocElem{"capped", true})
		cmd = append(cmd, bson.DocElem{"size", info.MaxBytes})
		if info.MaxDocs > 0 {
			cmd = append(cmd, bson.DocElem{"max", info.MaxDocs})
		}
	}
	if info.DisableIdIndex {
		cmd = append(cmd, bson.DocElem{"autoIndexId", false})
	}
	if info.ForceIdIndex {
		cmd = append(cmd, bson.DocElem{"autoIndexId", true})
	}
	return c.Database.Run(cmd, nil)
}
func ( c * Collection ) Create ( info * CollectionInfo ) error { cmd := make ( bson . D , 0 , 4 ) cmd = append ( cmd , bson . DocElem { " " , c . Name } ) if info . Capped { if info . MaxBytes < 1 { return fmt . Errorf ( " " ) } cmd = append ( cmd , bson . DocElem { " " , true } ) cmd = append ( cmd , bson . DocElem { " " , info . MaxBytes } ) if info . MaxDocs > 0 { cmd = append ( cmd , bson . DocElem { " " , info . MaxDocs } ) } } if info . DisableIdIndex { cmd = append ( cmd , bson . DocElem { " " , false } ) } if info . ForceIdIndex { cmd = append ( cmd , bson . DocElem { " " , true } ) } return c . Database . Run ( cmd , nil ) }
// Create explicitly creates the c collection with details of info.
// MongoDB creates collections automatically on use, so this method
// is only necessary when creating collection with non-default
// characteristics, such as capped collections.
//
// Relevant documentation:
//
//     http://www.mongodb.org/display/DOCS/createCollection+Command
//     http://www.mongodb.org/display/DOCS/Capped+Collections
//
Create explicitly creates the c collection with details of info . MongoDB creates collections automatically on use so this method is only necessary when creating collection with non - default characteristics such as capped collections . Relevant documentation : http : // www . mongodb . org / display / DOCS / createCollection + Command http : // www . mongodb . org / display / DOCS / Capped + Collections