示例#1
0
func DestroyMongoDB() {
	session, err := registry.CreateMongoDBClient()
	if err != nil {
		fmt.Printf("%s", err)
	}

	err = session.DB(registry.GetDatabaseName()).C(TABLE_NAME).DropCollection()

	if err != nil {
		fmt.Printf("%s", err)
	}
}
示例#2
0
// NildevInitMongoDB init
func NildevInitMongoDB() {
	// In which environment we are
	env := registry.GetEnv()
	fmt.Printf("%s", env)

	session, err := registry.CreateMongoDBClient()
	if err != nil {
		fmt.Printf("%s", err)
	}

	err = session.DB(registry.GetDatabaseName()).C(TABLE_NAME).Create(&mgo.CollectionInfo{})

	if err != nil {
		fmt.Printf("%s", err)
	}
}