@chevre/domain
Version:
Chevre Domain Library for Node.js
37 lines (28 loc) • 1.02 kB
text/typescript
// 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, { autoIndex: false });
const projectRepo = await chevre.repository.Project.createInstance(mongoose.connection);
const project = await projectRepo.findById({
id: PROJECT_ID,
inclusion: ['settings']
});
console.log('project:', project);
const projects = await projectRepo.projectFields(
{
limit: 1,
page: 1,
id: { $eq: project.id }
},
['typeOf']
);
console.log(projects);
console.log(projects.length, 'projects found');
const findAlternateNameByIdReulst = await projectRepo.findAlternateNameById({ id: project.id });
console.log('findAlternateNameByIdReulst:', findAlternateNameByIdReulst);
}
main()
.then(console.log)
.catch(console.error);