Skip to content

Separate rawQuery from url path for srv format URI#969

Open
anisurrahman75 wants to merge 1 commit into
alibaba:developfrom
kubedb:kubedb-migrator
Open

Separate rawQuery from url path for srv format URI#969
anisurrahman75 wants to merge 1 commit into
alibaba:developfrom
kubedb:kubedb-migrator

Conversation

@anisurrahman75
Copy link
Copy Markdown

No description provided.

Signed-off-by: Anisur Rahman <anisur@appscode.com>
Copilot AI review requested due to automatic review settings May 8, 2026 10:40
@CLAassistant
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Updates MongoDB URI handling to better support mongodb+srv:// by separating RawQuery from the path, and adjusts connection setup accordingly.

Changes:

  • Extend EncodeMongoURI to support mongodb+srv and to serialize query params via RawQuery instead of embedding them in Path.
  • Update connection initialization to use mongo.Connect and avoid forcing direct mode for SRV URIs.
  • Add a repo config file and a PID file under logs/.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.

File Description
mongoshake.conf Adds a config file with example connection settings (currently includes credentials).
logs/mongoshake.pid Adds a generated PID file to the repo.
common/community_client.go Adds SRV scheme support, modifies URI encoding, and tweaks client connection options.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread mongoshake.conf
Comment on lines +3 to +7
#mongo_urls = mongodb://root:O249MCkl.~laPeNe@10.2.0.216:30310/?directConnection=true
#mongo_urls = mongodb://root:O249MCkl.~laPeNe@10.42.0.96:27017,10.42.0.97:27017/?replicaSet=rs1
#mongo_urls = mongodb://root:O249MCkl.~laPeNe@127.0.0.1:27017/admin?directConnection=true
#mongo_urls = mongodb://msuser:MySafePassword123!@127.0.0.1:27018/admin?authSource=admin&directConnection=true
#tunnel.address = mongodb://root:b841Pt6cOrMppzmX@10.2.0.216:32255
Comment thread mongoshake.conf

conf.version = 11
mongo_urls =
tunnel.address= mongodb://root:YcYbhFKuCwso~CxL@10.2.0.216:30378
Comment thread logs/mongoshake.pid
@@ -0,0 +1 @@
144794
Comment on lines +88 to +92
isSrvURI := strings.HasPrefix(url, "mongodb+srv://")
clientOps := options.Client().ApplyURI(encodedURL)
//clientOps := options.Client().ApplyURI(url)
if !isSrvURI {
clientOps.SetDirect(true)
}
Comment on lines 316 to 328
hostPathParts := strings.SplitN(afterUserInfo, "/", 2)
host := hostPathParts[0]
var path string

var path, rawQuery string
if len(hostPathParts) > 1 {
path = "/" + hostPathParts[1]
} else {
path = ""
pathAndQuery := hostPathParts[1]
// split path and query
pathQueryParts := strings.SplitN(pathAndQuery, "?", 2)
path = "/" + pathQueryParts[0]
if len(pathQueryParts) > 1 {
rawQuery = pathQueryParts[1]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants