Example #1
0
// Drop drops the temp collection.
func Drop(db *db.DB) {
	col, err := db.CollectionMGO(tests.Context, CollectionExecTest)
	if err != nil {
		fmt.Printf("***********> Should be able to get a Mongo session : %v\n", err)
		return
	}

	col.DropCollection()
}
Example #2
0
// cleanupView removed a tempory view collection.
func cleanupView(context interface{}, db *db.DB, viewCol string) error {
	c, err := db.CollectionMGO(context, viewCol)
	if err != nil {
		return err
	}

	if err := c.DropCollection(); err != nil {
		return err
	}

	return nil
}
Example #3
0
// createCollection creates a collection in the new database.
func createCollection(db *db.DB, dbMeta *DBMeta, col *Collection, dropIdxs bool) error {
	mCol, err := db.CollectionMGO("", col.Name)
	if err != nil {
		return err
	}

	if err := mCol.Create(new(mgo.CollectionInfo)); err != nil {
		return err
	}

	if err := createIndexes(mCol, col, dropIdxs); err != nil {
		return err
	}

	return nil
}