mirror of https://github.com/status-im/migrate.git
Merge pull request #167 from arpando/fix/DocumentNilError
Fix document nil error
This commit is contained in:
commit
c0f025d2f6
|
@ -118,7 +118,7 @@ func (m *Mongo) SetVersion(version int, dirty bool) error {
|
|||
|
||||
func (m *Mongo) Version() (version int, dirty bool, err error) {
|
||||
var versionInfo versionInfo
|
||||
err = m.db.Collection(m.config.MigrationsCollection).FindOne(context.TODO(), nil).Decode(&versionInfo)
|
||||
err = m.db.Collection(m.config.MigrationsCollection).FindOne(context.TODO(), bson.M{}).Decode(&versionInfo)
|
||||
switch {
|
||||
case err == mongo.ErrNoDocuments:
|
||||
return database.NilVersion, false, nil
|
||||
|
|
Loading…
Reference in New Issue