@jokio/monzo
Version:
[](https://github.com/jokio/jok-cli)
34 lines (33 loc) • 1.42 kB
JavaScript
;
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
const index_1 = require("./index");
const connectionString = process.env.MONGO_DB_CONNECTION;
function run() {
return __awaiter(this, void 0, void 0, function* () {
// connect client
const client = yield index_1.getClient(connectionString);
// get db
const db = client.db();
// create repository
const collectionName = 'items';
const items = index_1.getRepository(db, collectionName, {
skipIdTransformations: true,
});
const item = yield items.create({
name: 'Ezeki',
});
// const item = await items.query(
// { id: '5c77f4ea1e40ca293af3fa72' },
// )
console.log('saved', item);
});
}
run();