UNPKG

@chevre/domain

Version:

Chevre Domain Library for Node.js

30 lines (24 loc) 956 B
// tslint:disable:no-console import * as mongoose from 'mongoose'; import { chevre } from '../../../../lib/index'; const project = { typeOf: chevre.factory.organizationType.Project, id: String(process.env.PROJECT_ID) }; async function main() { await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false }); const seatRepo = await chevre.repository.place.Seat.createInstance(mongoose.connection); const seatingTypes = await seatRepo.aggregateSeatingTypes({ project: { id: { $eq: project.id } }, branchCode: { $in: ['A-2', 'A-1'] }, containedInPlace: { branchCode: { $in: ['Default'] }, containedInPlace: { branchCode: { $eq: '100' }, containedInPlace: { branchCode: { $eq: '118' } } } } }); console.log(seatingTypes); console.log(seatingTypes.length); } main() .then(console.log) .catch(console.error);