Skip to content

Commit

Permalink
use unique index
Browse files Browse the repository at this point in the history
  • Loading branch information
MasterBool committed Jul 31, 2020
1 parent b60b442 commit 9002a91
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,6 @@
.glide/

.idea/
.vscode/
vendor/
*.iml
3 changes: 2 additions & 1 deletion adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 9002a91

Please sign in to comment.