Merge pull request #167 from arpando/fix/DocumentNilError

Fix document nil error
This commit is contained in:
Dale Hui 2019-02-05 03:48:34 -08:00 committed by GitHub
commit c0f025d2f6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -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