objectMongoDB
mongodb database connection object
usedb.openordb.openMongoDBCreated, created by:
1var mdb = db.openMongoDB("mongodb://host/db");
inheritance relationship
operator
operator[String]
Quickly get the specified collection access object
1readonly MongoCollection MongoDB[String];
Used to quickly get collection objects using attributes, for example:
1var test = mdb.test;
member function
getCollection
Get the specified collection access object
1MongoCollection MongoDB.getCollection(String name);
Call parameters:
- name: String, the name of the specified collection
return result:
- MongoCollection, returns the specified collection object
runCommand
Specifies a MongoDB database command
1Object MongoDB.runCommand(Object cmd);
Call parameters:
- cmd: Object, a dictionary object specifying commands and parameters
return result:
- Object, returns the command execution result
Specify a simple MongoDB database command
1
2Object MongoDB.runCommand(String cmd,
Value arg);
Call parameters:
- cmd: String, specifies the command name
- arg: Value, specifies the command parameter
return result:
- Object, returns the command execution result
oid
Generate a mongodb _objectid object
1MongoID MongoDB.oid(String hexStr = "");
Call parameters:
- hexStr: String, initialize a hexadecimal string, generate a new id by default
return result:
- MongoID, the new _objectid object
close
close the current database connection
1MongoDB.close() async;
toString
Return the string representation of the object, generally return "[Native Object]", the object can be reimplemented according to its own characteristics
1String MongoDB.toString();
return result:
- String, returns a string representation of the object
toJSON
Returns the JSON format representation of the object, generally returns a collection of readable properties defined by the object
1Value MongoDB.toJSON(String key = "");
Call parameters:
- key: String, not used
return result:
- Value, which returns a JSON-serializable value