class MongooseModel[T] extends Object

Mongoose Model

Annotations
@RawJSType() @native()
Linear Supertypes
Object, Any, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. MongooseModel
  2. Object
  3. Any
  4. AnyRef
  5. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new MongooseModel(doc: Any, fields: Array[String] = js.native, skipId: Boolean = js.native)

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. var $where: Any

    Additional properties to attach to the query when calling save() and isNew is false.

  4. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  5. def aggregate[A](pipeline: Any, callback: MongooseCallback[A]): Unit

    Performs aggregations on the models collection.

    Performs aggregations on the models collection.

    pipeline

    aggregation pipeline operator(s) or operator array

    callback

    the callback

    Example:
    1. aggregate([...], [callback])

  6. def aggregate[A](pipeline: Any): Aggregate[A]

    Performs aggregations on the models collection.

    Performs aggregations on the models collection.

    pipeline

    aggregation pipeline operator(s) or operator array

    returns

    the Aggregate

    Example:
    1. aggregate([...], [callback])

  7. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  8. def base: String

    Base Mongoose instance the model uses.

  9. def baseModelName: String

    If this is a discriminator model, baseModelName is the name of the base model.

  10. def clone(): AnyRef
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  11. def collection: Any

    Collection the model uses.

  12. def count(conditions: Any, callback: Function2[MongooseError, Int, Any]): Unit

    Counts number of matching documents in a database collection.

    Counts number of matching documents in a database collection.

    conditions

    the given query/conditions

    callback

    the callback

    Example:
    1. count(conditions, [callback])

  13. def count(conditions: Any): Promise[Int]

    Counts number of matching documents in a database collection.

    Counts number of matching documents in a database collection.

    conditions

    the given query/conditions

    returns

    the promise of the count

    Example:
    1. count(conditions, [callback])

  14. def create(docs: Array[T], callback: MongooseCallback[Array[T]]): Unit

    Shortcut for saving one or more documents to the database.

    Shortcut for saving one or more documents to the database. MyModel.create(docs) does new MyModel(doc).save() for every doc in docs.

    docs

    a document or array of documents

    callback

    the callback

  15. def create(doc: T, callback: Function2[MongooseError, T, Any]): Unit

    Shortcut for saving one or more documents to the database.

    Shortcut for saving one or more documents to the database. MyModel.create(docs) does new MyModel(doc).save() for every doc in docs.

    doc

    a document or array of documents

    callback

    the callback

  16. def create(docs: Array[T]): Promise[Array[T]]

    Shortcut for saving one or more documents to the database.

    Shortcut for saving one or more documents to the database. MyModel.create(docs) does new MyModel(doc).save() for every doc in docs.

    docs

    an array of documents to create

    returns

    the created documents

  17. def create(doc: T): Promise[T]

    Shortcut for saving one or more documents to the database.

    Shortcut for saving one or more documents to the database. MyModel.create(docs) does new MyModel(doc).save() for every doc in docs.

    doc

    a document to create

    returns

    the created documents

  18. def db: Connection

    Connection the model uses.

  19. def discriminator(name: String, schema: Schema[T]): Unit

    Adds a discriminator type.

    Adds a discriminator type.

    name

    the discriminator model name

    schema

    the discriminator model schema

  20. def discriminators: Any

    Registered discriminators for this model.

  21. def distinct(field: String, callback: MongooseCallback[Array[T]]): Unit

    Creates a Query for a distinct operation.

    Creates a Query for a distinct operation.

    field

    the field

    callback

    the callback

  22. def distinct(field: String, conditions: Any, callback: MongooseCallback[Array[T]]): Unit

    Creates a Query for a distinct operation.

    Creates a Query for a distinct operation.

    field

    the field

    conditions

    the optional condition

    callback

    the callback

  23. def distinct(field: String, conditions: Any = js.native): Query[Array[T]]

    Creates a Query for a distinct operation.

    Creates a Query for a distinct operation.

    field

    the field

    conditions

    the optional condition

    returns

    the resulting query

  24. val doc: Any
  25. def ensureIndexes(options: RawOptions, calback: Function1[MongooseError, Any]): Unit

    Sends ensureIndex commands to mongo for each index declared in the schema.

    Sends ensureIndex commands to mongo for each index declared in the schema.

    options

    the internal options

    calback

    the optional callback

  26. def ensureIndexes(options: RawOptions): Promise[Unit]

    Sends ensureIndex commands to mongo for each index declared in the schema.

    Sends ensureIndex commands to mongo for each index declared in the schema.

    options

    the internal options

    returns

    a promise of the completion

  27. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  28. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  29. val fields: Array[String]
  30. def finalize(): Unit
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  31. def find(conditions: Any, callback: MongooseModelArrayCallback[T]): Unit

    Finds documents

    Finds documents

    conditions

    the given conditions/query

    callback

    the optional callback

  32. def find(conditions: Any): Query[Array[Model[T]]]

    Finds documents

    Finds documents

    conditions

    the given conditions/query

    returns

    a Query

  33. def findById(id: |[|[ObjectId, String], Int], callback: MongooseModelCallback[T]): Unit

    Finds a single document by its _id field.

    Finds a single document by its _id field. findById(id) is almost* equivalent to findOne({ _id: id }). If you want to query by a document's _id, use findById() instead of findOne().

    id

    the value of _id to query by

    callback

    the optional callback

  34. def findById(id: |[|[ObjectId, String], Int], projection: RawOptions, callback: MongooseModelCallback[T]): Unit

    Finds a single document by its _id field.

    Finds a single document by its _id field. findById(id) is almost* equivalent to findOne({ _id: id }). If you want to query by a document's _id, use findById() instead of findOne().

    id

    the value of _id to query by

    projection

    the optional fields to return

    callback

    the optional callback

  35. def findById(id: |[|[ObjectId, String], Int], projection: RawOptions = js.native): Query[Model[T]]

    Finds a single document by its _id field.

    Finds a single document by its _id field. findById(id) is almost* equivalent to findOne({ _id: id }). If you want to query by a document's _id, use findById() instead of findOne().

    id

    the value of _id to query by

    projection

    the optional fields to return

    returns

    the Query

  36. def findByIdAndRemove(id: |[|[ObjectId, String], Int], callback: MongooseModelCallback[T]): Unit

    Issue a mongodb findAndModify remove command by a document's _id field.

    Issue a mongodb findAndModify remove command by a document's _id field. findByIdAndRemove(id, ...) is equivalent to findOneAndRemove({ _id: id }, ...).

    id

    the value of _id to query by

    callback

    the optional callback

    Example:
    1. findByIdAndRemove(id, [options], [callback])

  37. def findByIdAndRemove(id: |[|[ObjectId, String], Int], options: RawOptions, callback: MongooseModelCallback[T]): Unit

    Issue a mongodb findAndModify remove command by a document's _id field.

    Issue a mongodb findAndModify remove command by a document's _id field. findByIdAndRemove(id, ...) is equivalent to findOneAndRemove({ _id: id }, ...).

    id

    the value of _id to query by

    options

    the optional options

    callback

    the optional callback

    Example:
    1. findByIdAndRemove(id, [options], [callback])

  38. def findByIdAndRemove(id: |[|[ObjectId, String], Int], options: RawOptions = js.native): Promise[Model[T]]

    Issue a mongodb findAndModify remove command by a document's _id field.

    Issue a mongodb findAndModify remove command by a document's _id field. findByIdAndRemove(id, ...) is equivalent to findOneAndRemove({ _id: id }, ...).

    id

    the value of _id to query by

    options

    the optional options

    returns

    a promise of the results

    Example:
    1. findByIdAndRemove(id, [options], [callback])

  39. def findByIdAndUpdate(id: |[|[ObjectId, String], Int], update: Any, options: RawOptions, callback: MongooseModelCallback[T]): Unit

    Issues a mongodb findAndModify update command by a document's _id field.

    Issues a mongodb findAndModify update command by a document's _id field. findByIdAndUpdate(id, ...) is equivalent to findOneAndUpdate({ _id: id }, ...).

    id

    the value of _id to query by

    update

    the update sub-document

    options

    the optional options

    callback

    the optional callback

  40. def findByIdAndUpdate(id: |[|[ObjectId, String], Int], update: Any, callback: MongooseModelCallback[T]): Unit

    Issues a mongodb findAndModify update command by a document's _id field.

    Issues a mongodb findAndModify update command by a document's _id field. findByIdAndUpdate(id, ...) is equivalent to findOneAndUpdate({ _id: id }, ...).

    id

    the value of _id to query by

    update

    the update sub-document

    callback

    the optional callback

  41. def findByIdAndUpdate(id: |[|[ObjectId, String], Int], update: Any, options: RawOptions = js.native): Promise[Model[T]]

    Issues a mongodb findAndModify update command by a document's _id field.

    Issues a mongodb findAndModify update command by a document's _id field. findByIdAndUpdate(id, ...) is equivalent to findOneAndUpdate({ _id: id }, ...).

    id

    the value of _id to query by

    update

    the update sub-document

    options

    the optional options

    returns

    the promise of the document

  42. def findOne(conditions: Any, projection: Any, callback: MongooseModelCallback[T]): Unit

    Finds one document.

    Finds one document.

    conditions

    the conditions/query

    projection

    the optional fields to return

    callback

    the option callback

  43. def findOne(conditions: Any, callback: MongooseModelCallback[T]): Unit

    Finds one document.

    Finds one document.

    conditions

    the conditions/query

    callback

    the option callback

  44. def findOne(conditions: Any, projection: Any = js.native): Query[Model[T]]

    Finds one document.

    Finds one document.

    conditions

    the conditions/query

    projection

    the optional fields to return

    returns

    the Query

  45. def findOneAndRemove(conditions: Any, callback: MongooseModelCallback[T]): Unit

    Issue a mongodb findAndModify remove command.

    Issue a mongodb findAndModify remove command.

    conditions

    the conditions/query

    callback

    the option callback

  46. def findOneAndRemove(conditions: Any, options: RawOptions, callback: MongooseModelCallback[T]): Unit

    Issue a mongodb findAndModify remove command.

    Issue a mongodb findAndModify remove command.

    conditions

    the conditions/query

    options

    the optional options

    callback

    the option callback

  47. def findOneAndRemove(conditions: Any, options: RawOptions = js.native): Promise[Model[T]]

    Issue a mongodb findAndModify remove command.

    Issue a mongodb findAndModify remove command.

    conditions

    the conditions/query

    options

    the optional options

    returns

    the promise of the removed document

  48. def findOneAndUpdate(conditions: Any, update: Any, callback: MongooseModelCallback[T]): Unit

    Issues a mongodb findAndModify update command.

    Issues a mongodb findAndModify update command.

    conditions

    the conditions/query

    update

    the sub-document update

    callback

    the option callback

  49. def findOneAndUpdate(conditions: Any, update: Any, options: RawOptions, callback: MongooseModelCallback[T]): Unit

    Issues a mongodb findAndModify update command.

    Issues a mongodb findAndModify update command.

    conditions

    the conditions/query

    update

    the sub-document update

    options

    the optional options

    callback

    the option callback

  50. def findOneAndUpdate(conditions: Any, update: Any, options: RawOptions = js.native): Promise[Model[T]]

    Issues a mongodb findAndModify update command.

    Issues a mongodb findAndModify update command.

    conditions

    the conditions/query

    update

    the sub-document update

    options

    the optional options

    returns

    the promise of the updated document

  51. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
  52. def hasOwnProperty(v: String): Boolean
    Definition Classes
    Object
  53. def hashCode(): Int
    Definition Classes
    AnyRef → Any
  54. def insertMany(docs: Array[T], callback: MongooseModelArrayCallback[T]): Unit

    Shortcut for validating an array of documents and inserting them into MongoDB if they're all valid.

    Shortcut for validating an array of documents and inserting them into MongoDB if they're all valid. This function is faster than .create() because it only sends one operation to the server, rather than one for each document.

    docs

    the documents to insert

    callback

    the option callback

  55. def insertMany(docs: Array[T], options: RawOptions, callback: MongooseModelArrayCallback[T]): Unit

    Shortcut for validating an array of documents and inserting them into MongoDB if they're all valid.

    Shortcut for validating an array of documents and inserting them into MongoDB if they're all valid. This function is faster than .create() because it only sends one operation to the server, rather than one for each document.

    docs

    the documents to insert

    options

    the optional options

    callback

    the option callback

  56. def insertMany(docs: Array[T], options: RawOptions = js.native): Promise[Array[Model[T]]]

    Shortcut for validating an array of documents and inserting them into MongoDB if they're all valid.

    Shortcut for validating an array of documents and inserting them into MongoDB if they're all valid. This function is faster than .create() because it only sends one operation to the server, rather than one for each document.

    docs

    the documents to insert

    options

    the optional options

    returns

    a promise of the inserted documents

  57. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  58. def isPrototypeOf(v: Object): Boolean
    Definition Classes
    Object
  59. def mapReduce[A](obj: Any, callback: Function2[MongooseError, A, T]): Unit

    Executes a mapReduce command.

    Executes a mapReduce command.

    obj

    an object specifying map-reduce options

    callback

    the optional callback

  60. def mapReduce[A](obj: Any): Promise[A]

    Executes a mapReduce command.

    Executes a mapReduce command.

    obj

    an object specifying map-reduce options

    returns

    the promise of the results

  61. def model[A](name: String): MongooseModel[A]

    Returns another Model instance.

    Returns another Model instance.

    A

    the model type

    name

    the model name

    returns

    the model

  62. def modelName: String

    The name of the model

  63. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  64. final def notify(): Unit
    Definition Classes
    AnyRef
  65. final def notifyAll(): Unit
    Definition Classes
    AnyRef
  66. def populate(docs: Array[T], options: Dictionary[Any], callback: MongooseModelCallback[T]): Unit

    Populates document references.

    Populates document references.

    docs

    Either a single document or array of documents to populate.

    options

    A hash of key/val (path, options) used for population.

    callback

    Optional callback, executed upon completion. Receives err and the doc(s).

  67. def populate(docs: Array[T], options: Dictionary[Any]): Promise[Array[Model[T]]]

    Populates document references.

    Populates document references.

    docs

    an array of documents to populate.

    options

    A hash of key/val (path, options) used for population.

    returns

    the doc(s).

  68. def populate(docs: T, options: Dictionary[Any], callback: MongooseModelCallback[T]): Unit

    Populates document references.

    Populates document references.

    docs

    Either a single document or array of documents to populate.

    options

    A hash of key/val (path, options) used for population.

    callback

    Optional callback, executed upon completion. Receives err and the doc(s).

  69. def populate(doc: T, options: Dictionary[Any]): Promise[Model[T]]

    Populates document references.

    Populates document references.

    doc

    a single document to populate.

    options

    A hash of key/val (path, options) used for population.

    returns

    the doc(s).

  70. def propertyIsEnumerable(v: String): Boolean
    Definition Classes
    Object
  71. def remove(conditions: Any, callback: Function2[MongooseError, UpdateWriteResult, Any]): Unit

    Removes documents from the collection.

    Removes documents from the collection.

    conditions

    the conditions/query

    callback

    the optional callback

  72. def remove(conditions: Any): Promise[UpdateWriteResult]

    Removes documents from the collection.

    Removes documents from the collection.

    conditions

    the conditions/query

    returns

    the promise of the removed document

  73. def schema: Schema[T]

    The Schema the model uses.

  74. val skipId: Boolean
  75. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  76. def toLocaleString(): String
    Definition Classes
    Object
  77. def toString(): String
    Definition Classes
    AnyRef → Any
  78. def update(conditions: Any, doc: Any, callback: MongooseModelArrayCallback[T]): Unit

    Updates documents in the database without returning them.

    Updates documents in the database without returning them.

    conditions

    the conditions/query

    doc

    the sub-document to use in the update

    callback

    the optional callback

  79. def update(conditions: Any, doc: Any, options: RawOptions, callback: MongooseModelArrayCallback[T]): Unit

    Updates documents in the database without returning them.

    Updates documents in the database without returning them.

    conditions

    the conditions/query

    doc

    the sub-document to use in the update

    options

    the optional options

    callback

    the optional callback

  80. def update(conditions: Any, doc: Any, options: RawOptions = js.native): Promise[Array[Model[T]]]

    Updates documents in the database without returning them.

    Updates documents in the database without returning them.

    doc

    the sub-document to use in the update

    options

    the optional options

    returns

    the promise of the updated document

  81. def updateMany(conditions: Any, doc: Any, callback: MongooseModelArrayCallback[T]): Unit

    Same as update(), except MongoDB will update all documents that match criteria (as opposed to just the first one) regardless of the value of the multi option.

    Same as update(), except MongoDB will update all documents that match criteria (as opposed to just the first one) regardless of the value of the multi option.

    conditions

    the conditions/query

    doc

    the sub-document to use in the update

    callback

    the optional callback

  82. def updateMany(conditions: Any, doc: Any, options: RawOptions, callback: MongooseModelArrayCallback[T]): Unit

    Same as update(), except MongoDB will update all documents that match criteria (as opposed to just the first one) regardless of the value of the multi option.

    Same as update(), except MongoDB will update all documents that match criteria (as opposed to just the first one) regardless of the value of the multi option.

    conditions

    the conditions/query

    doc

    the sub-document to use in the update

    options

    the optional options

    callback

    the optional callback

  83. def updateMany(conditions: Any, doc: Any, options: RawOptions = js.native): Promise[Array[Model[T]]]

    Same as update(), except MongoDB will update all documents that match criteria (as opposed to just the first one) regardless of the value of the multi option.

    Same as update(), except MongoDB will update all documents that match criteria (as opposed to just the first one) regardless of the value of the multi option.

    doc

    the sub-document to use in the update

    options

    the optional options

    returns

    the promise of the updated document

  84. def updateOne(conditions: Any, doc: Any, callback: MongooseModelCallback[T]): Unit

    Same as update(), except MongoDB will update only the first document that matches criteria regardless of the value of the multi option.

    Same as update(), except MongoDB will update only the first document that matches criteria regardless of the value of the multi option.

    conditions

    the conditions/query

    doc

    the sub-document to use in the update

    callback

    the optional callback

  85. def updateOne(conditions: Any, doc: Any, options: RawOptions, callback: MongooseModelCallback[T]): Unit

    Same as update(), except MongoDB will update only the first document that matches criteria regardless of the value of the multi option.

    Same as update(), except MongoDB will update only the first document that matches criteria regardless of the value of the multi option.

    conditions

    the conditions/query

    doc

    the sub-document to use in the update

    options

    the optional options

    callback

    the optional callback

  86. def updateOne(conditions: Any, doc: Any, options: RawOptions = js.native): Promise[Model[T]]

    Same as update(), except MongoDB will update only the first document that matches criteria regardless of the value of the multi option.

    Same as update(), except MongoDB will update only the first document that matches criteria regardless of the value of the multi option.

    conditions

    the conditions/query

    doc

    the sub-document to use in the update

    options

    the optional options

    returns

    the promise of the updated document

  87. def valueOf(): Any
    Definition Classes
    Object
  88. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  89. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  90. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  91. def where(path: String, value: Any = js.native): QueryOperator[Array[T]]

    Creates a Query, applies the passed conditions, and returns the Query.

    Creates a Query, applies the passed conditions, and returns the Query.

    path

    the given path/field

    value

    the optional value

    returns

    the QueryOperator

Inherited from Object

Inherited from Any

Inherited from AnyRef

Inherited from Any

Ungrouped