I’m trying to find a bson struct tag to create a unique index just like the one in the image attached to this post but for mongodb. i tried searching and i found nothing Close to what i need but this stackoverflow post https://stackoverflow.com/questions/30831316/how-to-specify-a-struct-with-a-multi-column-unique-index-for-gorm
You must log in or register to comment.
Why don’t you just set the id to whatever ( e.g UUID) you want in your struct constructor. Alternatively I guess there are also mongodb specific client libraries for Go