Hi Asya,
I am using Strapi and the driver is Mongoose 5.8.0, services.common.startDbSession()
is just the wrapper of client.startSession()
.
Here is the client detail:
MongoClient {
_events: [Object: null prototype] {
newListener: [Function (anonymous)],
left: [Function (anonymous)]
},
_eventsCount: 2,
_maxListeners: undefined,
s: {
url: 'mongodb://some_url/strapi?ssl=true&replicaSet=Cluster0-shard-0&authSource=some_source&retryWrites=true&w=majority&readPreference=primaryPreferred',
options: {
servers: [Array],
ssl: true,
replicaSet: 'Cluster0-shard-0',
authSource: 'some_source',
retryWrites: true,
w: 'majority',
readPreference: [ReadPreference],
caseTranslate: true,
useNewUrlParser: true,
useUnifiedTopology: 'false',
promiseLibrary: [Function: Promise],
driverInfo: [Object],
auth: [Object],
dbName: 'strapi',
name: 'Mongoose',
version: '5.8.0',
socketTimeoutMS: 360000,
connectTimeoutMS: 30000,
useRecoveryToken: true,
credentials: [MongoCredentials]
},
promiseLibrary: [Function: Promise],
dbCache: Map(1) { 'strapi' => [Db] },
sessions: Set(0) {},
writeConcern: undefined,
namespace: MongoDBNamespace { db: 'some_db', collection: undefined }
},
topology: NativeTopology {
_events: [Object: null prototype] {
authenticated: [Function (anonymous)],
error: [Array],
timeout: [Array],
close: [Array],
parseError: [Array],
fullsetup: [Array],
all: [Array],
reconnect: [Array],
serverOpening: [Function (anonymous)],
serverDescriptionChanged: [Function (anonymous)],
serverHeartbeatStarted: [Function (anonymous)],
serverHeartbeatSucceeded: [Function (anonymous)],
serverHeartbeatFailed: [Function (anonymous)],
serverClosed: [Function (anonymous)],
topologyOpening: [Function (anonymous)],
topologyClosed: [Function (anonymous)],
topologyDescriptionChanged: [Function (anonymous)],
commandStarted: [Function (anonymous)],
commandSucceeded: [Function (anonymous)],
commandFailed: [Function (anonymous)],
joined: [Array],
left: [Array],
ping: [Function (anonymous)],
ha: [Function (anonymous)],
open: [Function],
reconnectFailed: [Function (anonymous)]
},
_eventsCount: 26,
_maxListeners: Infinity,
s: {
id: 0,
options: [Object],
seedlist: [Array],
state: 'connected',
description: [TopologyDescription],
serverSelectionTimeoutMS: 30000,
heartbeatFrequencyMS: 10000,
minHeartbeatFrequencyMS: 500,
Cursor: [Function: Cursor],
bson: BSON {},
servers: [Map],
sessionPool: [ServerSessionPool],
sessions: Set(0) {},
promiseLibrary: [Function: Promise],
credentials: [MongoCredentials],
clusterTime: [Object],
iterationTimers: Set(0) {},
connectionTimers: Set(0) {},
clientInfo: [Object],
sCapabilities: [ServerCapabilities]
},
[Symbol(kCapture)]: false
},
[Symbol(kCapture)]: false
}
And yes, I can see the TRANSACTION_IN_PROGRESS from the session:
ClientSession {
_events: [Object: null prototype] {
ended: [Function: bound onceWrapper] { listener: [Function (anonymous)] }
},
_eventsCount: 1,
_maxListeners: undefined,
topology: NativeTopology {
_events: [Object: null prototype] {
authenticated: [Function (anonymous)],
error: [Array],
timeout: [Array],
close: [Array],
parseError: [Array],
fullsetup: [Array],
all: [Array],
reconnect: [Array],
serverOpening: [Function (anonymous)],
serverDescriptionChanged: [Function (anonymous)],
serverHeartbeatStarted: [Function (anonymous)],
serverHeartbeatSucceeded: [Function (anonymous)],
serverHeartbeatFailed: [Function (anonymous)],
serverClosed: [Function (anonymous)],
topologyOpening: [Function (anonymous)],
topologyClosed: [Function (anonymous)],
topologyDescriptionChanged: [Function (anonymous)],
commandStarted: [Function (anonymous)],
commandSucceeded: [Function (anonymous)],
commandFailed: [Function (anonymous)],
joined: [Array],
left: [Array],
ping: [Function (anonymous)],
ha: [Function (anonymous)],
open: [Function],
reconnectFailed: [Function (anonymous)]
},
_eventsCount: 26,
_maxListeners: Infinity,
s: {
id: 0,
options: [Object],
seedlist: [Array],
state: 'connected',
description: [TopologyDescription],
serverSelectionTimeoutMS: 30000,
heartbeatFrequencyMS: 10000,
minHeartbeatFrequencyMS: 500,
Cursor: [Function: Cursor],
bson: BSON {},
servers: [Map],
sessionPool: [ServerSessionPool],
sessions: [Set],
promiseLibrary: [Function: Promise],
credentials: [MongoCredentials],
clusterTime: [Object],
iterationTimers: Set(0) {},
connectionTimers: Set(0) {},
clientInfo: [Object],
sCapabilities: [ServerCapabilities]
},
[Symbol(kCapture)]: false
},
sessionPool: ServerSessionPool {
topology: NativeTopology {
_events: [Object: null prototype],
_eventsCount: 26,
_maxListeners: Infinity,
s: [Object],
[Symbol(kCapture)]: false
},
sessions: [
[ServerSession], [ServerSession],
[ServerSession], [ServerSession],
[ServerSession], [ServerSession],
[ServerSession], [ServerSession],
[ServerSession], [ServerSession],
[ServerSession], [ServerSession],
[ServerSession], [ServerSession],
[ServerSession]
]
},
hasEnded: false,
serverSession: ServerSession {
id: { id: [Binary] },
lastUse: 1591716044756,
txnNumber: 2,
isDirty: false
},
clientOptions: {
servers: [ [Object], [Object], [Object] ],
ssl: true,
replicaSet: 'Cluster0-shard-0',
authSource: 'some_source',
retryWrites: true,
w: 'majority',
readPreference: ReadPreference { mode: 'primaryPreferred', tags: undefined },
caseTranslate: true,
useNewUrlParser: true,
useUnifiedTopology: 'false',
promiseLibrary: [Function: Promise],
driverInfo: { name: 'Mongoose', version: '5.8.0' },
auth: {
username: 'some_username',
password: 'some_password',
db: 'some_db',
user: 'some_user'
},
dbName: 'strapi',
name: 'Mongoose',
version: '5.8.0',
socketTimeoutMS: 360000,
connectTimeoutMS: 30000,
useRecoveryToken: true,
credentials: MongoCredentials {
username: 'some_username',
password: 'some_password',
source: 'some_source',
mechanism: 'scram-sha-1',
mechanismProperties: undefined
}
},
supports: { causalConsistency: true },
clusterTime: {
clusterTime: Timestamp { _bsontype: 'Timestamp', low_: 2, high_: 1591716043 },
signature: { hash: [Binary], keyId: [Long] }
},
operationTime: Timestamp { _bsontype: 'Timestamp', low_: 2, high_: 1591716043 },
explicit: true,
owner: undefined,
defaultTransactionOptions: {},
transaction: Transaction {
state: 'TRANSACTION_IN_PROGRESS',
options: {
writeConcern: [Object],
readConcern: [Object],
readPreference: 'primary'
},
_pinnedServer: undefined,
_recoveryToken: undefined
},
[Symbol(kCapture)]: false
}
Hopefully this helps.