const classafMongo::MongoDb
sys::Obj afMongo::MongoDb
Represents a MongoDB database.
- cmd
MongoCmd cmd(Str cmdName, Obj? cmdVal := 1)
For Power Users!
Runs an arbitrary command against this database.
Don't forget to call
run()
!- collection
MongoColl collection(Str collectionName)
Returns a
Collection
with the given name.Note this just instantiates the Fantom object, it does not create anything in MongoDB.
- connMgr
const MongoConnMgr connMgr
The underlying connection manager.
- drop
Drops the database. Be careful!
@see https://www.mongodb.com/docs/manual/reference/command/dropDatabase/
- get
@
Operator
MongoColl get(Str collectionName)Convenience / shorthand notation for
collection(name)
- listCollectionNames
Str[] listCollectionNames()
Returns all the collection (and view) names in this Mongo database.
This is more optimised than just calling
listCollections()
.@see https://www.mongodb.com/docs/manual/reference/command/listCollections/
- listCollections
MongoCur listCollections([Str:Obj?]? filter := null)
Returns a list of collections and views in this database, along with some basic info.
@see https://www.mongodb.com/docs/manual/reference/command/listCollections/
- make
new make(MongoConnMgr connMgr, Str? name := null)
Creates a
Database
with the given name.Note this just instantiates the Fantom object, it does not create anything in MongoDB.
- name
const Str name
The name of the database.