Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
goSDN
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
danet
goSDN
Merge requests
!495
Update mongo driver and fix deprecations
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Update mongo driver and fix deprecations
fix-deprecations
into
master
Overview
0
Commits
5
Pipelines
2
Changes
7
Merged
Ghost User
requested to merge
fix-deprecations
into
master
1 year ago
Overview
0
Commits
5
Pipelines
2
Changes
7
Expand
Description
Update mongo driver and fix deprecations. Also set version of installed tools in variables.
Checklist:
My code follows the code style of this project.
My change requires a change to the documentation.
I have updated the documentation accordingly.
I have read the
CONTRIBUTING
document.
I have added tests to cover my changes.
All new and existing tests passed.
0
0
Merge request reports
Compare
master
version 1
44981ff2
1 year ago
master (base)
and
latest version
latest version
151655a4
5 commits,
1 year ago
version 1
44981ff2
4 commits,
1 year ago
7 files
+
28
−
18
Side-by-side
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
7
Search (e.g. *.vue) (Ctrl+P)
controller/nucleus/database/mongo-connection.go
+
2
−
7
Options
@@ -20,16 +20,11 @@ const (
@@ -20,16 +20,11 @@ const (
// GetMongoConnection Retrieves a client to the MongoDB.
// GetMongoConnection Retrieves a client to the MongoDB.
func
GetMongoConnection
()
(
*
mongo
.
Client
,
context
.
Context
,
context
.
CancelFunc
)
{
func
GetMongoConnection
()
(
*
mongo
.
Client
,
context
.
Context
,
context
.
CancelFunc
)
{
mongoConnection
:=
config
.
DatabaseConnection
mongoConnection
:=
config
.
DatabaseConnection
client
,
err
:=
mongo
.
NewClient
(
options
.
Client
()
.
ApplyURI
(
mongoConnection
))
if
err
!=
nil
{
log
.
Printf
(
"Failed to create client: %v"
,
err
)
}
ctx
,
cancel
:=
context
.
WithTimeout
(
context
.
Background
(),
connectTimeout
*
time
.
Second
)
ctx
,
cancel
:=
context
.
WithTimeout
(
context
.
Background
(),
connectTimeout
*
time
.
Second
)
err
=
client
.
Connect
(
ctx
)
client
,
err
:
=
mongo
.
Connect
(
ctx
,
options
.
Client
()
.
ApplyURI
(
mongo
Connect
ion
)
)
if
err
!=
nil
{
if
err
!=
nil
{
log
.
Printf
(
"Failed to c
onnect to cluster
: %v"
,
err
)
log
.
Printf
(
"Failed to c
reate client
: %v"
,
err
)
}
}
// Force a connection to verify our connection string
// Force a connection to verify our connection string
Loading