Skip to content

Commit

Permalink
Merge pull request #28 from lxzan/master
Browse files Browse the repository at this point in the history
use unique index
  • Loading branch information
hsluoyz authored Sep 16, 2020
2 parents 92b21a8 + 9002a91 commit ddc19c8
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 ddc19c8

Please sign in to comment.