Update MongoDB Driver and Configuration for Company Entities

- Updated the MongoDB driver from v1.17.4 to v2.3.0, ensuring compatibility with the latest features and improvements.
- Refactored company-related entity and repository files to utilize the new driver, replacing `primitive.ObjectID` with `bson.ObjectID` for ID handling.
- Adjusted the configuration in `.drone.yml` to include the `main` branch in the trigger settings, enhancing CI/CD pipeline flexibility.
This commit is contained in:
n.nakhostin
2025-09-09 18:53:39 +03:30
parent 57c29dc58f
commit 5d721705b7
24 changed files with 64 additions and 130 deletions
+3 -8
View File
@@ -1,15 +1,15 @@
package mongo
import (
"go.mongodb.org/mongo-driver/bson"
"go.mongodb.org/mongo-driver/mongo/options"
"go.mongodb.org/mongo-driver/v2/bson"
"go.mongodb.org/mongo-driver/v2/mongo/options"
)
// Index represents a MongoDB index
type Index struct {
Name string `json:"name"`
Keys bson.D `json:"keys"`
Options *options.IndexOptions `json:"options"`
Options *options.IndexOptionsBuilder `json:"options"`
}
// NewIndex creates a new index with default options
@@ -33,11 +33,6 @@ func (i *Index) WithSparse(sparse bool) *Index {
return i
}
// WithBackground sets the background option for the index
func (i *Index) WithBackground(background bool) *Index {
i.Options.SetBackground(background)
return i
}
// WithExpireAfterSeconds sets the TTL for the index
func (i *Index) WithExpireAfterSeconds(seconds int32) *Index {