const classafMongo::MongoClient
sys::Obj afMongo::MongoClient
A MongoDB client.
This class is the main starting point for connecting to a MongoDB instance.
Retrieving data from a MongoDB can be as easy as:
mongo := MongoClient(`mongodb://localhost:27017/`)
data  := mongo.db("db").collection("col").find
Or using defaults and shorthand notation:
data := mongo["db"]["col"].find
- adminCmd
- MongoCmd adminCmd(Str cmdName, Obj? cmdVal := 1)- For Power Users! - Runs an arbitrary command against the - admindatabase.- Don't forget to call - run()!
- buildInfo
- Returns a build information of the connected MongoDB server. Use to obtain the version of the MongoDB server. - @see https://www.mongodb.com/docs/manual/reference/command/buildInfo/ 
- connMgr
- const MongoConnMgr connMgr- The connection manager that Mongo connections are leased from. 
- db
- MongoDb db(Str? dbName := null)- Returns a - Databasewith the given name.- If - dbNameis- null, the default database from- MongoConnMgris used.- Note this just instantiates the Fantom object, it does not create anything in the database. 
- get
- @Operator
 MongoDb get(Str dbName)- Convenience / shorthand notation for - db(name)
- hello
- Sends a - hellocommand - if- hellois not available, a legacy- isMastercommand is sent instead.
- listDatabaseNames
- Str[] listDatabaseNames()- Returns all the database names on the MongoDB instance. - This is more optimised than just calling - listDatabases().
- listDatabases
- Str:Obj?[] listDatabases([Str:Obj?]? filter := null)- Returns a list of existing databases, along with some basic info. - @see https://www.mongodb.com/docs/manual/reference/command/listDatabases/ 
- make
- new make(MongoConnMgr connMgr)- Creates a - MongoClientwith the given- ConnectionManager.
- makeFromUri
- new makeFromUri(Uri mongoUrl)- Creates a - MongoClientwith a pooled connection to the given Mongo connection URL.
- ping
- Sends a - pingcommand to the server.- pingsshould return straight away, even if the server is write-locked.- @see https://www.mongodb.com/docs/manual/reference/command/ping/ 
- shutdown
- Void shutdown()- Convenience for - MongoConnMgr.shutdown().