mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-11-03 18:52:15 +08:00
version log index
This commit is contained in:
parent
f8394d4fd8
commit
187903e3c3
@ -18,8 +18,8 @@ import (
|
|||||||
|
|
||||||
func NewVersionLog(coll *mongo.Collection) (database.VersionLog, error) {
|
func NewVersionLog(coll *mongo.Collection) (database.VersionLog, error) {
|
||||||
lm := &VersionLogMgo{coll: coll}
|
lm := &VersionLogMgo{coll: coll}
|
||||||
if lm.initIndex(context.Background()) != nil {
|
if err := lm.initIndex(context.Background()); err != nil {
|
||||||
return nil, errs.ErrInternalServer.WrapMsg("init index failed", "coll", coll.Name())
|
return nil, errs.WrapMsg(err, "init version log index failed", "coll", coll.Name())
|
||||||
}
|
}
|
||||||
return lm, nil
|
return lm, nil
|
||||||
}
|
}
|
||||||
@ -33,6 +33,7 @@ func (l *VersionLogMgo) initIndex(ctx context.Context) error {
|
|||||||
Keys: bson.M{
|
Keys: bson.M{
|
||||||
"d_id": 1,
|
"d_id": 1,
|
||||||
},
|
},
|
||||||
|
Options: options.Index().SetUnique(true),
|
||||||
})
|
})
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user