How to use the mingo.Aggregator function in mingo

To help you get started, we’ve selected a few mingo examples, based on popular ways it is used in public projects.

github amelisa / amelisa / src / mongo / MongoQueries.js View on Github external
getQueryResultFromArray (allDocs, expression) {
    expression = this.normalizeExpression(expression)

    if (expression.$aggregate) {
      let agg = new Mingo.Aggregator(expression.$aggregate)

    let mingoQuery = new Mingo.Query(expression.$query)
    let cursor = mingoQuery.find(allDocs)

    if (expression.$orderby) cursor.sort(expression.$orderby)

    if (expression.$skip) cursor.skip(expression.$skip)

    if (expression.$limit) cursor.limit(expression.$limit)

    if (expression.$findOptions) {
      for (let key in expression.$findOptions) {
        let value = expression.$findOptions[key]
        cursor = cursor[key](value)


MongoDB query language for in-memory objects

Latest version published 2 months ago

Package Health Score

83 / 100
Full package analysis