UNPKG

@chevre/domain

Version:

Chevre Domain Library for Node.js

32 lines (25 loc) 987 B
// tslint:disable:no-console import * as mongoose from 'mongoose'; import { chevre } from '../../../lib/index'; // const project = { id: String(process.env.PROJECT_ID) }; async function main() { await mongoose.connect(<string>process.env.MONGOLAB_URI); const categoryCodeRepo = await chevre.repository.CategoryCode.createInstance(mongoose.connection); const categoryCodes = await categoryCodeRepo.searchByAggregate( { limit: 100, page: 1, sort: { codeValue: chevre.factory.sortType.Ascending } // id: { $eq: 'xxx' } // project: { id: { $eq: project.id } } // paymentAccepted: { paymentMethodType: { $eq: 'Cash' } }, // hasMerchantReturnPolicy: { applicablePaymentMethod: {} } }, ['id'] ); console.log('categoryCodes found', categoryCodes[0]); console.log(categoryCodes.length, 'categoryCodes found'); } main() .then() .catch(console.error);