Class

io.scalajs.npm.mongodb

Db

Related Doc: package mongodb

Permalink

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)

    Permalink
  2. new Db()

    Permalink
  3. new Db(databaseName: String, replicaSet: ReplSet, options: DbOptions)

    Permalink

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. def addUser(username: String, password: String, callback: MongoCallback[CommandResult]): Unit

    Permalink

    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: MongoCallback[CommandResult]): Unit

    Permalink

    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]

    Permalink

    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

    Permalink

    Returns the Admin db instance

    Returns the Admin db instance

    returns

    the Admin db instance

  8. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  9. def authenticate(username: String, password: String, callback: MongoCallback[CommandResult]): Unit

    Permalink

    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: MongoCallback[CommandResult]): Unit

    Permalink

    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]

    Permalink

    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

    Permalink
  13. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  14. def close(callback: MongoCallback[Null]): Unit

    Permalink

    Close the db and its underlying connections

    Close the db and its underlying connections

    callback

    the results callback

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

    Permalink

    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]

    Permalink

    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: MongoCallback[Collection]): Unit

    Permalink

    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: MongoCallback[Collection]): Unit

    Permalink

    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

    Permalink

    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: MongoCallback[Array[Collection]]): Unit

    Permalink

    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]]

    Permalink

    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: MongoCallback[CommandResult]): Unit

    Permalink

    Execute a command

    Execute a command

    command

    the command hash

    callback

    the results callback

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

    Permalink

    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]

    Permalink

    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: MongoCallback[Collection]): Unit

    Permalink

    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: MongoCallback[Collection]): Unit

    Permalink

    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]

    Permalink

    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: MongoCallback[CommandResult]): Unit

    Permalink

    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: MongoCallback[CommandResult]): Unit

    Permalink

    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]

    Permalink

    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

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

    Permalink

    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: MongoCallback[CommandResult]): Unit

    Permalink

    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]

    Permalink

    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: MongoCallback[CommandResult]): Unit

    Permalink

    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]

    Permalink

    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: MongoCallback[CommandResult]): Unit

    Permalink

    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: MongoCallback[CommandResult]): Unit

    Permalink

    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]

    Permalink

    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

    Permalink
    Definition Classes
    AnyRef
  41. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  42. def eval(code: Code, parameters: |[Array[String], Any], callback: MongoCallback[CommandResult]): Unit

    Permalink

    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: MongoCallback[CommandResult]): Unit

    Permalink

    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]

    Permalink

    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: MongoCallback[CommandResult]): Unit

    Permalink

    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: MongoCallback[CommandResult]): Unit

    Permalink

    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]

    Permalink

    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

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  49. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  50. def hasOwnProperty(v: String): Boolean

    Permalink
    Definition Classes
    Object
  51. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  52. def indexInformation(name: String, callback: Function2[MongoError, Any, Any]): Unit

    Permalink

    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

    Permalink

    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]

    Permalink

    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

    Permalink
    Definition Classes
    Any
  56. def isPrototypeOf(v: Object): Boolean

    Permalink
    Definition Classes
    Object
  57. def listCollections(filter: Any = js.native, options: |[ListCollectionsOptions, RawOptions] = js.native): CommandCursor[CollectionInfo]

    Permalink

    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: MongoCallback[CommandResult]): Unit

    Permalink

    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: MongoCallback[CommandResult]): Unit

    Permalink

    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]

    Permalink

    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

    Permalink
  62. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  63. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  64. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  65. def open(callback: MongoCallback[Db]): Unit

    Permalink

    Open the database

    Open the database

    callback

    the callback

  66. def open(): Promise[Db]

    Permalink

    Open the database

  67. val options: DbOptions

    Permalink
  68. def propertyIsEnumerable(v: String): Boolean

    Permalink
    Definition Classes
    Object
  69. def removeUser(username: String, callback: MongoCallback[CommandResult]): Unit

    Permalink

    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: MongoCallback[CommandResult]): Unit

    Permalink

    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]

    Permalink

    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: MongoCallback[CommandResult]): Unit

    Permalink

    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: MongoCallback[CommandResult]): Unit

    Permalink

    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]

    Permalink

    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

    Permalink
  76. var serverConfig: Any

    Permalink
  77. var slaveOk: Boolean

    Permalink
  78. def stats(callback: MongoCallback[DbStats]): Unit

    Permalink

    Get all the db statistics.

    Get all the db statistics.

    callback

    the collection result callback

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

    Permalink

    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): MongoCallback[DbStats]

    Permalink

    Get all the db statistics.

    Get all the db statistics.

    options

    the optional settings.

  81. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  82. def toLocaleString(): String

    Permalink
    Definition Classes
    Object
  83. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  84. var topology: Any

    Permalink
  85. def unref(): Unit

    Permalink

    Unref all sockets

  86. def valueOf(): Any

    Permalink
    Definition Classes
    Object
  87. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  88. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  89. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  90. var writeConcern: Any

    Permalink

Inherited from Object

Inherited from Any

Inherited from AnyRef

Inherited from Any

Ungrouped