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:
+5
-6
@@ -15,10 +15,9 @@ import (
|
||||
"tm/pkg/logger"
|
||||
"tm/pkg/mongo"
|
||||
|
||||
"go.mongodb.org/mongo-driver/bson"
|
||||
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||
mongoDriver "go.mongodb.org/mongo-driver/mongo"
|
||||
"go.mongodb.org/mongo-driver/mongo/options"
|
||||
"go.mongodb.org/mongo-driver/v2/bson"
|
||||
mongoDriver "go.mongodb.org/mongo-driver/v2/mongo"
|
||||
"go.mongodb.org/mongo-driver/v2/mongo/options"
|
||||
)
|
||||
|
||||
// TEDScraper handles downloading and parsing TED XML files
|
||||
@@ -70,7 +69,7 @@ type ScrapingState struct {
|
||||
LastRunAt int64 `bson:"last_run_at" json:"last_run_at"`
|
||||
NextRunAt int64 `bson:"next_run_at" json:"next_run_at"`
|
||||
IsRunning bool `bson:"is_running" json:"is_running"`
|
||||
CurrentJobID primitive.ObjectID `bson:"current_job_id,omitempty" json:"current_job_id,omitempty"`
|
||||
CurrentJobID bson.ObjectID `bson:"current_job_id,omitempty" json:"current_job_id,omitempty"`
|
||||
}
|
||||
|
||||
// ScraperConfig holds configuration for the TED scraper
|
||||
@@ -758,7 +757,7 @@ func (s *TEDScraper) completeJob(ctx context.Context, job *ScrapingJob, state *S
|
||||
|
||||
// Update state
|
||||
state.IsRunning = false
|
||||
state.CurrentJobID = primitive.NilObjectID
|
||||
state.CurrentJobID = bson.NilObjectID
|
||||
state.LastRunAt = completedAt
|
||||
state.NextRunAt = endTime.Add(s.config.ScrapingInterval).Unix()
|
||||
state.UpdatedAt = completedAt
|
||||
|
||||
Reference in New Issue
Block a user