done check log
This commit is contained in:
parent
a095bb9f08
commit
110127e76a
3
index.go
3
index.go
|
@ -13,7 +13,6 @@ import (
|
||||||
|
|
||||||
// CreateIndex ...
|
// CreateIndex ...
|
||||||
func CreateIndex(colName string, ind mongo.IndexModel) {
|
func CreateIndex(colName string, ind mongo.IndexModel) {
|
||||||
fmt.Println("db name:", db.Name())
|
|
||||||
// Get collection
|
// Get collection
|
||||||
col := db.Collection(colName)
|
col := db.Collection(colName)
|
||||||
if col == nil {
|
if col == nil {
|
||||||
|
@ -21,8 +20,6 @@ func CreateIndex(colName string, ind mongo.IndexModel) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Println("ind", ind)
|
|
||||||
|
|
||||||
opts := options.CreateIndexes().SetMaxTime(time.Minute * 10)
|
opts := options.CreateIndexes().SetMaxTime(time.Minute * 10)
|
||||||
_, err := col.Indexes().CreateOne(context.Background(), ind, opts)
|
_, err := col.Indexes().CreateOne(context.Background(), ind, opts)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in New Issue