fix mongodb startup

This commit is contained in:
Philipp Kunz 2016-11-18 13:20:43 +01:00
parent 715709f3ec
commit b45e7ee206
3 changed files with 11 additions and 4 deletions

View File

@ -1,7 +1,7 @@
import { DbCollection } from './smartdata.classes.dbcollection';
export declare type TDocCreation = 'db' | 'new' | 'mixed';
/**
* sva - saveable decorator to be used on class properties
* saveable - saveable decorator to be used on class properties
*/
export declare function saveable(target: DbDoc<any>, key: string): void;
export declare class DbDoc<T> {

View File

@ -1,6 +1,6 @@
"use strict";
/**
* sva - saveable decorator to be used on class properties
* saveable - saveable decorator to be used on class properties
*/
function saveable(target, key) {
console.log('called sva');
@ -26,6 +26,13 @@ class DbDoc {
for (let propertyNameString of this.saveableProperties) {
saveableObject[propertyNameString] = this[propertyNameString];
}
switch (this.creationType) {
case 'db':
this.collection; // TODO implement collection.update()
break;
case 'new':
this.collection.insertOne(saveableObject);
}
}
/**
* also store any referenced objects to DB
@ -36,4 +43,4 @@ class DbDoc {
}
}
exports.DbDoc = DbDoc;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRkYXRhLmNsYXNzZXMuZGJkb2MuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9zbWFydGRhdGEuY2xhc3Nlcy5kYmRvYy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBT0E7O0dBRUc7QUFDSCxrQkFBeUIsTUFBa0IsRUFBRSxHQUFXO0lBQ3BELE9BQU8sQ0FBQyxHQUFHLENBQUMsWUFBWSxDQUFDLENBQUE7SUFDekIsRUFBRSxDQUFDLENBQUMsQ0FBQyxNQUFNLENBQUMsa0JBQWtCLENBQUMsQ0FBQyxDQUFDO1FBQUMsTUFBTSxDQUFDLGtCQUFrQixHQUFHLEVBQUUsQ0FBQTtJQUFDLENBQUM7SUFDbEUsTUFBTSxDQUFDLGtCQUFrQixDQUFDLElBQUksQ0FBQyxHQUFHLENBQUMsQ0FBQTtBQU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QUN2QyxDQUFDO0FBSkQsNEJBSUM7QUFFRDtJQWlCSTs7T0FFRztJQUNIO1FBQ0ksSUFBSSxDQUFDLFVBQVUsR0FBRyxJQUFJLENBQUMsV0FBVyxDQUFDLGNBQWMsQ0FBQyxDQUFBO0lBQ3RELENBQUM7SUFFRDs7O09BR0c7SUFDSCxJQUFJO1FBQ0EsSUFBSSxjQUFjLEdBQUcsRUFBRSxDQUFBO1FBQ3ZCLEdBQUcsQ0FBQyxDQUFDLElBQUksa0JBQWtCLElBQUksSUFBSSxDQUFDLGtCQUFrQixDQUFDLENBQUMsQ0FBQztZQUNyRCxjQUFjLENBQUMsa0JBQWtCLENBQUMsR0FBRyxJQUFJLENBQUMsa0JBQWtCLENBQUMsQ0FBQTtRQUNqRSxDQUFDO1FBQ0QsTUFBTSxDQUFDLENBQUMsSUFBSSxDQUFDLFlBQVksQ0FBQyxDQUFDLENBQUM7WUFDeEIsS0FBSyxJQUFJO2dCQUNMLElBQUksQ0FBQyxVQUFVLENBQUEsQ0FBQyxxQ0FBcUM7Z0JBQ3JELEtBQUssQ0FBQTtZQUNULEtBQUssS0FBSztnQkFDTixJQUFJLENBQUMsVUFBVSxDQUFDLFNBQVMsQ0FBQyxjQUFjLENBQUMsQ0FBQTtRQUNqRCxDQUFDO0lBQ0wsQ0FBQztJQUVEOzs7T0FHRztJQUNILFFBQVE7UUFDSixJQUFJLENBQUMsSUFBSSxFQUFFLENBQUE7SUFDZixDQUFDO0NBQ0o7QUFqREQsc0JBaURDIn0=

View File

@ -23,7 +23,7 @@ describe('mongodb', function () {
this.timeout(30000)
mongoChildProcess = shelljs.exec('mongod --dbpath=./test/data --port 27017', { async: true, silent: true })
let doneCalled = false
mongoChildProcess.stdout.on('new', function (data) {
mongoChildProcess.stdout.on('data', function (data) {
console.log(smartstring.indent.indentWithPrefix(data, '*** MongoDB Process *** : '))
if (!doneCalled) {
if (/waiting for connections on port 27017/.test(data)) {