class Db extends Object

Mongo Database

Annotations
@RawJSType() @native() @JSImport( "mongodb" , "Db" )
See also

https://mongodb.github.io/node-mongodb-native/api-articles/nodekoarticle1.html

Linear Supertypes
Object, Any, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Db
  2. Object
  3. Any
  4. AnyRef
  5. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new Db(databaseName: String, server: Server)
  2. new Db()
  3. new Db(databaseName: String, replicaSet: ReplSet, options: DbOptions)

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. def addUser(username: String, password: String, callback: MongoCallback1[CommandResult]): Unit

    Add a user to the database.

    Add a user to the database.

    username

    the username.

    password

    the password.

    callback

    the results callback

  5. def addUser(username: String, password: String, options: RawOptions, callback: MongoCallback1[CommandResult]): Unit

    Add a user to the database.

    Add a user to the database.

    username

    the username.

    password

    the password.

    options

    the optional settings.

    callback

    the results callback

  6. def addUser(username: String, password: String, options: RawOptions = js.native): Promise[CommandResult]

    Add a user to the database.

    Add a user to the database.

    username

    the username.

    password

    the password.

    options

    the optional settings.

    returns

    the promise of the result

  7. def admin(): Admin

    Returns the Admin db instance

    Returns the Admin db instance

    returns

    the Admin db instance

  8. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  9. def authenticate(username: String, password: String, callback: MongoCallback1[CommandResult]): Unit

    Authenticate a user against the server.

    Authenticate a user against the server.

    username

    the username.

    password

    the password.

    callback

    the results callback

  10. def authenticate(username: String, password: String, options: RawOptions, callback: MongoCallback1[CommandResult]): Unit

    Authenticate a user against the server.

    Authenticate a user against the server.

    username

    the username.

    password

    the password.

    options

    the optional settings.

    callback

    the results callback

  11. def authenticate(username: String, password: String, options: RawOptions = js.native): Promise[CommandResult]

    Authenticate a user against the server.

    Authenticate a user against the server.

    username

    the username.

    password

    the password.

    options

    the optional settings.

    returns

    the promise of the result

  12. var bufferMaxEntries: Int
  13. def clone(): AnyRef
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  14. def close(callback: MongoCallback1[Null]): Unit

    Close the db and its underlying connections

    Close the db and its underlying connections

    callback

    the results callback

  15. def close(force: Boolean, callback: MongoCallback1[Null]): Unit

    Close the db and its underlying connections

    Close the db and its underlying connections

    force

    Force close, emitting no events

    callback

    the results callback

  16. def close(force: Boolean = js.native): Promise[Null]

    Close the db and its underlying connections

    Close the db and its underlying connections

    force

    Force close, emitting no events

    returns

    the promise of the result

  17. def collection(name: String, options: |[CollectionOptions, RawOptions], callback: MongoCallback1[Collection]): Unit

    Fetch a specific collection (containing the actual collection information).

    Fetch a specific collection (containing the actual collection information). If the application does not use strict mode you can can use it without a callback in the following way:

    var collection = db.collection('mycollection');
    name

    the collection name we wish to access.

    options

    the optional settings.

    callback

    the collection result callback

  18. def collection(name: String, callback: MongoCallback1[Collection]): Unit

    Fetch a specific collection (containing the actual collection information).

    Fetch a specific collection (containing the actual collection information). If the application does not use strict mode you can can use it without a callback in the following way:

    var collection = db.collection('mycollection');
    name

    the collection name we wish to access.

    callback

    the collection result callback

  19. def collection(name: String, options: |[CollectionOptions, RawOptions] = js.native): Collection

    Fetch a specific collection (containing the actual collection information).

    Fetch a specific collection (containing the actual collection information). If the application does not use strict mode you can can use it without a callback in the following way:

    var collection = db.collection('mycollection');
    name

    the collection name we wish to access.

    returns

    the collection

  20. def collections(callback: MongoCallback1[Array[Collection]]): Unit

    Fetch all collections for the current db.

    Fetch all collections for the current db.

    callback

    the collections result callback

  21. def collections(): Promise[Array[Collection]]

    Fetch all collections for the current db.

    Fetch all collections for the current db.

    returns

    the promise of an array of collections

  22. def command(command: Any, callback: MongoCallback1[CommandResult]): Unit

    Execute a command

    Execute a command

    command

    the command hash

    callback

    the results callback

  23. def command(command: Any, options: RawOptions, callback: MongoCallback1[CommandResult]): Unit

    Execute a command

    Execute a command

    command

    the command hash

    options

    the optional settings.

    callback

    the results callback

  24. def command(command: Any, options: RawOptions = js.native): Promise[CommandResult]

    Execute a command

    Execute a command

    command

    the command hash

    options

    the optional settings.

    returns

    the promise of the result

  25. def createCollection(name: String, callback: MongoCallback1[Collection]): Unit

    Create a new collection on a server with the specified options.

    Create a new collection on a server with the specified options. Use this to create capped collections. More information about command options available at https://docs.mongodb.com/manual/reference/command/create/

    name

    the collection name we wish to access.

    callback

    the results callback

  26. def createCollection(name: String, options: |[CollectionOptions, RawOptions], callback: MongoCallback1[Collection]): Unit

    Create a new collection on a server with the specified options.

    Create a new collection on a server with the specified options. Use this to create capped collections. More information about command options available at https://docs.mongodb.com/manual/reference/command/create/

    name

    the collection name we wish to access.

    options

    the optional settings

    callback

    the results callback

  27. def createCollection(name: String, options: |[CollectionOptions, RawOptions] = js.native): Promise[Collection]

    Create a new collection on a server with the specified options.

    Create a new collection on a server with the specified options. Use this to create capped collections. More information about command options available at https://docs.mongodb.com/manual/reference/command/create/

    name

    the collection name we wish to access.

    options

    the optional settings

    returns

    a promise of the result

  28. def createIndex(name: String, fieldOrSpec: |[String, Any], callback: MongoCallback1[CommandResult]): Unit

    Creates an index on the db and collection collection.

    Creates an index on the db and collection collection.

    name

    the name of the collection to create the index on.

    fieldOrSpec

    defines the index.

    callback

    the results callback

  29. def createIndex(name: String, fieldOrSpec: |[String, Any], options: |[IndexOptions, RawOptions], callback: MongoCallback1[CommandResult]): Unit

    Creates an index on the db and collection collection.

    Creates an index on the db and collection collection.

    name

    the name of the collection to create the index on.

    fieldOrSpec

    defines the index.

    options

    the optional settings.

    callback

    the results callback

  30. def createIndex(name: String, fieldOrSpec: |[String, Any], options: |[IndexOptions, RawOptions] = js.native): Promise[CommandResult]

    Creates an index on the db and collection collection.

    Creates an index on the db and collection collection.

    name

    the name of the collection to create the index on.

    fieldOrSpec

    defines the index.

    options

    the optional settings.

    returns

    the promise of the result

  31. val databaseName: String
  32. def db(databaseName: String, options: DbSharingOptions = js.native): Db

    Create a new Db instance sharing the current socket connections.

    Create a new Db instance sharing the current socket connections. Be aware that the new db instances are related in a parent-child relationship to the original instance so that events are correctly emitted on child db instances. Child db instances are cached so performing db('db1') twice will return the same instance. You can control these behaviors with the options noListener and returnNonCachedInstance.

    databaseName

    the name of the database we want to use.

    options

    the optional settings.

  33. def dropCollection(name: String, callback: MongoCallback1[CommandResult]): Unit

    Drop a collection from the database, removing it permanently.

    Drop a collection from the database, removing it permanently. New accesses will create a new collection.

    name

    the name of collection to drop

    callback

    the results callback

  34. def dropCollection(name: String): Promise[CommandResult]

    Drop a collection from the database, removing it permanently.

    Drop a collection from the database, removing it permanently. New accesses will create a new collection.

    name

    the name of collection to drop

    returns

    the promise of the result

  35. def dropDatabase(callback: MongoCallback1[CommandResult]): Unit

    Drop a database, removing it permanently from the server.

    Drop a database, removing it permanently from the server.

    callback

    the callback containing a reference to this instance

  36. def dropDatabase(): Promise[CommandResult]

    Drop a database, removing it permanently from the server.

    Drop a database, removing it permanently from the server.

    returns

    the promise of the result

  37. def ensureIndex(name: String, fieldOrSpec: |[String, Any], callback: MongoCallback1[CommandResult]): Unit

    Ensures that an index exists, if it does not it creates it

    Ensures that an index exists, if it does not it creates it

    name

    the name of the collection to create the index on.

    fieldOrSpec

    defines the index.

    callback

    the results callback

  38. def ensureIndex(name: String, fieldOrSpec: |[String, Any], options: |[IndexOptions, RawOptions], callback: MongoCallback1[CommandResult]): Unit

    Ensures that an index exists, if it does not it creates it

    Ensures that an index exists, if it does not it creates it

    name

    the name of the collection to create the index on.

    fieldOrSpec

    defines the index.

    options

    the optional settings.

    callback

    the results callback

  39. def ensureIndex(name: String, fieldOrSpec: |[String, Any], options: |[IndexOptions, RawOptions] = js.native): Promise[CommandResult]

    Ensures that an index exists, if it does not it creates it

    Ensures that an index exists, if it does not it creates it

    name

    the name of the collection to create the index on.

    fieldOrSpec

    defines the index.

    options

    the optional settings.

    returns

    the promise of the result

  40. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  41. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  42. def eval(code: Code, parameters: |[Array[String], Any], callback: MongoCallback1[CommandResult]): Unit

    Evaluate JavaScript on the server

    Evaluate JavaScript on the server

    code

    JavaScript to execute on server.

    parameters

    The parameters for the call.

    callback

    the results callback

  43. def eval(code: Code, parameters: |[Array[String], Any], options: RawOptions, callback: MongoCallback1[CommandResult]): Unit

    Evaluate JavaScript on the server

    Evaluate JavaScript on the server

    code

    JavaScript to execute on server.

    parameters

    The parameters for the call.

    options

    the optional settings.

    callback

    the results callback

  44. def eval(code: Code, parameters: |[Array[String], Any], options: RawOptions = js.native): Promise[CommandResult]

    Evaluate JavaScript on the server

    Evaluate JavaScript on the server

    code

    JavaScript to execute on server.

    parameters

    The parameters for the call.

    options

    the optional settings.

    returns

    the promise of the result

  45. def executeDbAdminCommand(command: Any, callback: MongoCallback1[CommandResult]): Unit

    Runs a command on the database as admin.

    Runs a command on the database as admin.

    command

    the command hash

    callback

    the results callback

  46. def executeDbAdminCommand(command: Any, options: |[ReadPreferenceOptions, RawOptions], callback: MongoCallback1[CommandResult]): Unit

    Runs a command on the database as admin.

    Runs a command on the database as admin.

    command

    the command hash

    options

    the optional settings.

    callback

    the results callback

  47. def executeDbAdminCommand(command: Any, options: |[ReadPreferenceOptions, RawOptions] = js.native): Promise[CommandResult]

    Runs a command on the database as admin.

    Runs a command on the database as admin.

    command

    the command hash

    options

    the optional settings.

    returns

    the promise of the result

  48. def finalize(): Unit
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  49. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
  50. def hasOwnProperty(v: String): Boolean
    Definition Classes
    Object
  51. def hashCode(): Int
    Definition Classes
    AnyRef → Any
  52. def indexInformation(name: String, callback: Function2[MongoError, Any, Any]): Unit

    Retrieves this collections index info.

    Retrieves this collections index info.

    name

    the name of the collection.

    callback

    the callback containing the index information

  53. def indexInformation(name: String, options: |[IndexInformationOptions, RawOptions], callback: Function2[MongoError, Any, Any]): Unit

    Retrieves this collections index info.

    Retrieves this collections index info.

    name

    the name of the collection.

    options

    the optional settings.

    callback

    the callback containing the index information

  54. def indexInformation(name: String, options: |[IndexInformationOptions, RawOptions] = js.native): Promise[Any]

    Retrieves this collections index info.

    Retrieves this collections index info.

    name

    the name of the collection.

    options

    the optional settings.

    returns

    a promise of the index information

  55. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  56. def isPrototypeOf(v: Object): Boolean
    Definition Classes
    Object
  57. def listCollections(filter: Any = js.native, options: |[ListCollectionsOptions, RawOptions] = js.native): CommandCursor[CollectionInfo]

    Get the list of all collection information for the specified db.

    Get the list of all collection information for the specified db.

    filter

    query to filter collections by

    options

    the qptional settings.

    returns

    a CommandCursor containing the results

  58. def logout(callback: MongoCallback1[CommandResult]): Unit

    Logout user from server, fire off on all connections and remove all auth info

    Logout user from server, fire off on all connections and remove all auth info

    callback

    the command result callback

  59. def logout(options: RawOptions, callback: MongoCallback1[CommandResult]): Unit

    Logout user from server, fire off on all connections and remove all auth info

    Logout user from server, fire off on all connections and remove all auth info

    options

    the optional settings.

    callback

    the command result callback

  60. def logout(options: RawOptions): Promise[CommandResult]

    Logout user from server, fire off on all connections and remove all auth info

    Logout user from server, fire off on all connections and remove all auth info

    options

    the optional settings.

    returns

    the promise of the result

  61. var native_parser: Boolean
  62. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  63. final def notify(): Unit
    Definition Classes
    AnyRef
  64. final def notifyAll(): Unit
    Definition Classes
    AnyRef
  65. def open(callback: MongoCallback1[Db]): Unit

    Open the database

    Open the database

    callback

    the callback

  66. def open(): Promise[Db]

    Open the database

    Open the database

    returns

    the promise of a Db

  67. val options: DbOptions
  68. def propertyIsEnumerable(v: String): Boolean
    Definition Classes
    Object
  69. def removeUser(username: String, callback: MongoCallback1[CommandResult]): Unit

    Remove a user from a database

    Remove a user from a database

    username

    the username.

    callback

    the command result callback

  70. def removeUser(username: String, options: |[RemoveUserOptions, RawOptions], callback: MongoCallback1[CommandResult]): Unit

    Remove a user from a database

    Remove a user from a database

    username

    the username.

    options

    the optional settings.

    callback

    the command result callback

  71. def removeUser(username: String, options: |[RemoveUserOptions, RawOptions] = js.native): Promise[CommandResult]

    Remove a user from a database

    Remove a user from a database

    username

    the username.

    options

    the optional settings.

    returns

    the promise of the result

  72. def renameCollection(fromCollection: String, toCollection: String, callback: MongoCallback1[CommandResult]): Unit

    Rename a collection.

    Rename a collection.

    fromCollection

    the name of current collection to rename.

    toCollection

    the new name of of the collection.

    callback

    the results callback

  73. def renameCollection(fromCollection: String, toCollection: String, options: |[RenameOptions, RawOptions], callback: MongoCallback1[CommandResult]): Unit

    Rename a collection.

    Rename a collection.

    fromCollection

    the name of current collection to rename.

    toCollection

    the new name of of the collection.

    options

    the optional settings.

    callback

    the results callback

  74. def renameCollection(fromCollection: String, toCollection: String, options: |[RenameOptions, RawOptions] = js.native): Promise[CommandResult]

    Rename a collection.

    Rename a collection.

    fromCollection

    the name of current collection to rename.

    toCollection

    the new name of of the collection.

    options

    the optional settings.

    returns

    the promise of the result

  75. val replicaSet: ReplSet
  76. var serverConfig: Any
  77. var slaveOk: Boolean
  78. def stats(callback: MongoCallback1[DbStats]): Unit

    Get all the db statistics.

    Get all the db statistics.

    callback

    the collection result callback

  79. def stats(options: |[DbStatsOptions, RawOptions], callback: MongoCallback1[DbStats]): Unit

    Get all the db statistics.

    Get all the db statistics.

    options

    the optional settings.

    callback

    the collection result callback

  80. def stats(options: |[DbStatsOptions, RawOptions] = js.native): MongoCallback1[DbStats]

    Get all the db statistics.

    Get all the db statistics.

    options

    the optional settings.

  81. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  82. def toLocaleString(): String
    Definition Classes
    Object
  83. def toString(): String
    Definition Classes
    AnyRef → Any
  84. var topology: Any
  85. def unref(): Unit

    Unref all sockets

  86. def valueOf(): Any
    Definition Classes
    Object
  87. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  88. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  89. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  90. var writeConcern: Any

Inherited from Object

Inherited from Any

Inherited from AnyRef

Inherited from Any

Ungrouped