SERVER-103603: Support .d.ts typings for common "conn" and "db" workflows (#35071)

GitOrigin-RevId: cce8abff91406ea4ed5be849ea3e041b4ac0bc86
This commit is contained in:
Steve McClure 2025-04-16 15:35:39 -04:00 committed by MongoDB Bot
parent fe4ae2cca3
commit 9661e67028
7 changed files with 12 additions and 15 deletions

View File

@ -11,5 +11,8 @@
"src/mongo/shell/*.js",
"src/mongo/shell/*.d.ts",
"src/third_party/fast_check/**/*"
],
"exclude": [
"jstests/libs/override_methods/"
]
}

View File

@ -10,7 +10,7 @@ function setupTest() {
print("START auth1.js");
baseName = "jstests_auth_auth1";
m = MongoRunner.runMongod({auth: "", bind_ip: "127.0.0.1", useHostname: false});
let m = MongoRunner.runMongod({auth: "", bind_ip: "127.0.0.1", useHostname: false});
return m;
}

View File

@ -12,8 +12,8 @@ declare class DBCollection {
getName()
help()
getFullName()
getMongo()
getDB()
getMongo(): Mongo
getDB(): DB
find(filter, projection, limit, skip, batchSize, options)
insert(obj, options)
remove(t, justOne)

View File

@ -17,11 +17,9 @@ declare class DB {
[collectionIndex: string]: DBCollection
rotateCertificates(message)
getMongo()
getSiblingDB(name)
getName()
getSiblingDB(name): DB
stats(opt)
getCollection(name)
getCollection(name): DBCollection
commandHelp(name)
runReadCommand()
runCommand(obj, extra, queryOptions)

View File

@ -2,11 +2,7 @@
declare class Mongo {
constructor(uri?: string, encryptedDBClientCallback?, options?: object)
getDB(name): DB
startSession(opts?): DriverSession
find(ns, query, fields, limit, skip, batchSize, options)
insert(ns, obj)
remove(ns, pattern)
@ -15,7 +11,7 @@ declare class Mongo {
getSlaveOk()
setSecondaryOk(value = true)
getSecondaryOk()
getDB(name)
getDB(name: string): DB
getDBs(driverSession)
adminCommand(cmd)
runCommand(dbname, cmd, options)

View File

@ -1,8 +1,8 @@
// type declarations for servers.js
declare module MongoRunner {
export function runMongod(opts?: object): Mongo
export function stopMongod(connection: Mongo): void
function runMongod(opts?: object): Mongo
function stopMongod(connection: Mongo): void
}
declare function myPort()

View File

@ -1,4 +1,4 @@
// type declarations for utils_sh.js
declare var db
declare var db: DB
declare function printShardingStatus()