1.修改代码适配阿里云的服务器

This commit is contained in:
whm
2026-03-17 14:27:32 +08:00
parent 826617d737
commit 20e7f3a65d
1777 changed files with 775041 additions and 10 deletions

View File

@@ -0,0 +1,41 @@
// Copyright (C) MongoDB, Inc. 2025-present.
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may
// not use this file except in compliance with the License. You may obtain
// a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
//go:build mongointernal
package mongo
import (
"time"
"go.mongodb.org/mongo-driver/v2/bson"
"go.mongodb.org/mongo-driver/v2/x/bsonx/bsoncore"
"go.mongodb.org/mongo-driver/v2/x/mongo/driver/session"
)
// NewSessionWithLSID returns a Session with the given sessionID document. The
// sessionID is a BSON document with key "id" containing a 16-byte UUID (binary
// subtype 4).
//
// Sessions returned by NewSessionWithLSID are never added to the driver's
// session pool. Calling "EndSession" or "ClientSession.SetServer" on a Session
// returned by NewSessionWithLSID will panic.
//
// NewSessionWithLSID is intended only for internal use and may be changed or
// removed at any time.
func NewSessionWithLSID(client *Client, sessionID bson.Raw) *Session {
return &Session{
clientSession: &session.Client{
Server: &session.Server{
SessionID: bsoncore.Document(sessionID),
LastUsed: time.Now(),
},
ClientID: client.id,
},
client: client,
deployment: client.deployment,
}
}