class Aggregate[T] extends Object with QueryExecutable[T]
Mongoose Aggregate
- Annotations
- @RawJSType() @native() @JSImport( "mongoose" , "Aggregate" )
- See also
http://mongoosejs.com/docs/api.html#aggregate_Aggregate
- Alphabetic
- By Inheritance
- Aggregate
- QueryExecutable
- Object
- Any
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Instance Constructors
-
new
Aggregate(ops: Any)
Aggregate constructor used for building aggregation pipelines.
Aggregate constructor used for building aggregation pipelines.
- ops
aggregation operator(s) or operator array
- returns
a new Aggregate instance
new Aggregate([{ $project: { a: 1, b: 1 } }, { $skip: 5 }]);
, new Aggregate({ $project: { a: 1, b: 1 } }, { $skip: 5 });
, new Aggregate({ $project: { a: 1, b: 1 } });
, new Aggregate();
Examples: - new Aggregate()
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
addCursorFlag(flag: String, value: Boolean): Aggregate.this.type
Adds a cursor flag
Adds a cursor flag
- flag
the flag
- value
the value
-
def
allowDiskUse(value: Boolean, tags: Any): Aggregate.this.type
Sets the allowDiskUse option for the aggregation query (ignored for < 2.6.0)
Sets the allowDiskUse option for the aggregation query (ignored for < 2.6.0)
- value
Should tell server it can use hard drive to store data during aggregation.
- tags
optional tags for this query
-
def
append(ops: Any): Aggregate.this.type
Appends new operators to this aggregate pipeline
Appends new operators to this aggregate pipeline
- ops
the operator(s) to append
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
def
collation(collation: RawOptions, value: Boolean): Aggregate.this.type
Adds a collation
Adds a collation
- collation
the collation options
- value
the boolean indicator
-
def
cursor(options: RawOptions): AggregateCursor[T]
Sets the cursor option option for the aggregation query (ignored for < 2.6.0).
Sets the cursor option option for the aggregation query (ignored for < 2.6.0). Note the different syntax below: .exec() returns a cursor object, and no callback is necessary.
- options
the set the cursor batch size
var cursor = Model.aggregate(..).cursor({ batchSize: 1000 }).exec(); cursor.each(function(error, doc) { // use doc });
Example: -
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
exec(callback: Function2[MongooseError, T, Any]): Unit
- Definition Classes
- QueryExecutable
-
def
exec(): Promise[T]
- Definition Classes
- QueryExecutable
-
def
explain(callback: Function2[MongooseError, T, Any] = js.native): Promise[T]
Execute the aggregation with explain
Execute the aggregation with explain
- callback
the callback
- returns
a promise of the results
-
def
facet(facet: RawOptions): Aggregate.this.type
Combines multiple aggregation pipelines.
Combines multiple aggregation pipelines.
- facet
the options
-
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
-
def
graphLookup(options: RawOptions): Aggregate.this.type
Appends new custom $graphLookup operator(s) to this aggregate pipeline, performing a recursive search on a collection.
Appends new custom $graphLookup operator(s) to this aggregate pipeline, performing a recursive search on a collection. Note that graphLookup can only consume at most 100MB of memory, and does not allow disk use even if { allowDiskUse: true } is specified.
- options
to $graphLookup as described in the above link
-
def
group(arg: Any): Aggregate.this.type
Appends a new custom $group operator to this aggregate pipeline.
Appends a new custom $group operator to this aggregate pipeline.
- arg
the $group operator contents
-
def
hasOwnProperty(v: String): Boolean
- Definition Classes
- Object
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
def
isPrototypeOf(v: Object): Boolean
- Definition Classes
- Object
-
def
limit(num: Int): Aggregate.this.type
Appends a new $limit operator to this aggregate pipeline.
Appends a new $limit operator to this aggregate pipeline.
- num
the maximum number of records to pass to the next stage
-
def
lookup(options: RawOptions): Aggregate.this.type
Appends new custom $lookup operator(s) to this aggregate pipeline.
Appends new custom $lookup operator(s) to this aggregate pipeline.
- options
to $lookup as described in the above link
-
def
match(arg: Any): Aggregate.this.type
Appends a new custom $match operator to this aggregate pipeline.
Appends a new custom $match operator to this aggregate pipeline.
- arg
the $match operator contents
-
def
model[A](model: MongooseModel[A]): Aggregate.this.type
Binds this aggregate to a model.
Binds this aggregate to a model.
- model
the model to which the aggregate is to be bound
- returns
the Aggregate
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
near(parameters: RawOptions): Aggregate.this.type
Appends a new $geoNear operator to this aggregate pipeline.
Appends a new $geoNear operator to this aggregate pipeline. NOTE: MUST be used as the first operator in the pipeline.
- parameters
the given parameters
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
-
def
project(arg: |[String, Any]): Aggregate.this.type
Appends a new $project operator to this aggregate pipeline.
Appends a new $project operator to this aggregate pipeline.
- arg
the field specification
- returns
the Aggregate
-
def
propertyIsEnumerable(v: String): Boolean
- Definition Classes
- Object
-
def
read(pref: String, tags: Any = js.native): Aggregate.this.type
Sets the readPreference option for the aggregation query.
Sets the readPreference option for the aggregation query.
- pref
one of the listed preference options or their aliases
- tags
optional tags for this query
- returns
the Aggregate
-
def
sample(size: Int): Aggregate.this.type
Appepnds new custom $sample operator(s) to this aggregate pipeline.
Appepnds new custom $sample operator(s) to this aggregate pipeline.
- size
the number of random documents to pick
- returns
the Aggregate
-
def
skip(num: Int): Aggregate.this.type
Appends a new $skip operator to this aggregate pipeline.
Appends a new $skip operator to this aggregate pipeline.
- num
the number of records to skip before next stage
- returns
the Aggregate
-
def
sort(arg: |[String, Any]): Aggregate.this.type
Appends a new $sort operator to this aggregate pipeline.
Appends a new $sort operator to this aggregate pipeline.
- arg
the sorting arguments
- returns
the Aggregate
aggregate.sort('field -test');
, aggregate.sort({ field: 'asc', test: -1 });
Examples: -
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
then(resolve: Function = js.native, reject: Function = js.native): Promise[T]
Provides promise for aggregate.
Provides promise for aggregate.
- resolve
the success callback
- reject
the error callback
- returns
a promise
Model.aggregate(..).then(successCallback, errorCallback);
Example: -
def
toLocaleString(): String
- Definition Classes
- Object
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
def
unwind(fields: String): Aggregate.this.type
Appends new custom $unwind operator(s) to this aggregate pipeline.
Appends new custom $unwind operator(s) to this aggregate pipeline.
Note that the $unwind operator requires the path name to start with '$'. Mongoose will prepend '$' if the specified field doesn't start '$'.
- fields
the field(s) to unwind
- returns
the Aggregate
-
def
valueOf(): Any
- Definition Classes
- Object
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )