How to use the aom._id function in aom

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

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github betagouv / preuve-covoiturage / api / services / stats / calculators / duration-all-times.js View on Github external
durationAllTimes({ aom = null, startDate = '2019-01-01T00:00:00Z' }) {
    const $match = {
      'passenger.start.datetime': { $gte: startDate, $lt: new Date() },
    };
    if (aom) $match['aom._id'] = aom;

    const args = [
      {
        $match,
      },
      {
        $group: {
          _id: {
            name: 'duration',
          },
          total: {
            $sum: { $max: ['$passenger.duration', '$passenger.calc_duration'] },
          },
        },
      },
    ];
github betagouv / preuve-covoiturage / api / services / stats / calculators / duration-per-day.js View on Github external
durationPerDay({ aom = null, startDate = '2019-01-01T00:00:00Z' }) {
    const $match = {
      'passenger.start.datetime': { $gte: startDate, $lt: new Date() },
    };
    if (aom) $match['aom._id'] = aom;

    const args = [
      {
        $match,
      },
      {
        $project: {
          year: { $year: '$passenger.start.datetime' },
          month: { $month: '$passenger.start.datetime' },
          day: { $dayOfMonth: '$passenger.start.datetime' },
          duration: { $max: ['$passenger.duration', '$passenger.calc_duration'] },
        },
      },
      {
        $group: {
          _id: {
github betagouv / preuve-covoiturage / api / services / stats / calculators / journeys-per-day.js View on Github external
journeysPerDay({ aom = null, startDate = '2019-01-01T00:00:00Z' }) {
    const $match = {
      'passenger.start.datetime': { $gte: startDate, $lt: new Date() },
    };
    if (aom) $match['aom._id'] = aom;

    const args = [
      {
        $match,
      },
      {
        $project: {
          year: { $year: '$passenger.start.datetime' },
          month: { $month: '$passenger.start.datetime' },
          day: { $dayOfMonth: '$passenger.start.datetime' },
        },
      },
      {
        $group: {
          _id: {
            name: 'journeys_per_day',
github betagouv / preuve-covoiturage / api / services / stats / calculators / journeys-per-month.js View on Github external
journeysPerMonth({ aom = null, startDate = '2019-01-01T00:00:00Z' }) {
    const $match = {
      'passenger.start.datetime': { $gte: startDate, $lt: new Date() },
    };
    if (aom) $match['aom._id'] = aom;

    const args = [
      {
        $match,
      },
      {
        $project: {
          year: { $year: '$passenger.start.datetime' },
          month: { $month: '$passenger.start.datetime' },
        },
      },
      {
        $group: {
          _id: {
            name: 'journeys_per_month',
            year: '$year',
github betagouv / preuve-covoiturage / api / services / stats / calculators / distance-all-times.js View on Github external
distanceAllTimes({ aom = null, startDate = '2019-01-01T00:00:00Z' }) {
    const $match = {
      'passenger.start.datetime': { $gte: startDate, $lt: new Date() },
    };
    if (aom) $match['aom._id'] = aom;

    const args = [
      {
        $match,
      },
      {
        $group: {
          _id: {
            name: 'distance',
          },
          total: {
            $sum: { $max: ['$passenger.distance', '$passenger.calc_distance'] },
          },
        },
      },
    ];
github betagouv / preuve-covoiturage / api / services / stats / calculators / distance-per-month.js View on Github external
distancePerMonth({ aom = null, startDate = '2019-01-01T00:00:00Z' }) {
    const $match = {
      'passenger.start.datetime': { $gte: startDate, $lt: new Date() },
    };
    if (aom) $match['aom._id'] = aom;

    const args = [
      {
        $match,
      },
      {
        $project: {
          year: { $year: '$passenger.start.datetime' },
          month: { $month: '$passenger.start.datetime' },
          distance: { $max: ['$passenger.distance', '$passenger.calc_distance'] },
        },
      },
      {
        $group: {
          _id: {
            name: 'distance_per_day',
github betagouv / preuve-covoiturage / api / services / stats / calculators / journeys-all-times.js View on Github external
journeysAllTimes({ aom = null, startDate = '2019-01-01T00:00:00Z' }) {
    const args = {
      'passenger.start.datetime': { $gte: startDate, $lt: new Date() },
    };

    if (aom) args['aom._id'] = aom;

    return {
      collection: 'journeys',
      commands: [
        {
          args,
          command: 'find',
        },
        {
          command: 'count',
        },
      ],
    };
  },
};
github betagouv / preuve-covoiturage / api / services / stats / calculators / distance-per-day.js View on Github external
distancePerDay({ aom = null, startDate = '2019-01-01T00:00:00Z' }) {
    const $match = {
      'passenger.start.datetime': { $gte: startDate, $lt: new Date() },
    };
    if (aom) $match['aom._id'] = aom;

    const args = [
      {
        $match,
      },
      {
        $project: {
          year: { $year: '$passenger.start.datetime' },
          month: { $month: '$passenger.start.datetime' },
          day: { $dayOfMonth: '$passenger.start.datetime' },
          distance: { $max: ['$passenger.distance', '$passenger.calc_distance'] },
        },
      },
      {
        $group: {
          _id: {

aom

API Over Models: typescript-decorators meta-framework

MIT
Latest version published 2 years ago

Package Health Score

36 / 100
Full package analysis

Popular aom functions