diff --git a/.gitignore b/.gitignore index d7c6275..ef707d2 100644 --- a/.gitignore +++ b/.gitignore @@ -14,4 +14,6 @@ .glide/ .idea/ +.vscode/ +vendor/ *.iml \ No newline at end of file diff --git a/adapter.go b/adapter.go index 2140a48..190a6fa 100644 --- a/adapter.go +++ b/adapter.go @@ -146,7 +146,8 @@ func (a *adapter) open(databaseName string) error { if _, err = collection.Indexes().CreateOne( context.Background(), mongo.IndexModel{ - Keys: keysDoc, + Keys: keysDoc, + Options: options.Index().SetUnique(true), }, ); err != nil { return err