From e37b56e7e9335f61fd09bced51e437ee0ed14ec9 Mon Sep 17 00:00:00 2001 From: Benjamin Pannell Date: Tue, 17 Nov 2015 07:14:00 +0200 Subject: [PATCH] benchmark: Update benchmark file to make use of latest API --- benchmarks/mongodb.ts | 17 +++++++++-------- benchmarks/tsconfig.json | 10 ++++++++++ 2 files changed, 19 insertions(+), 8 deletions(-) create mode 100644 benchmarks/tsconfig.json diff --git a/benchmarks/mongodb.ts b/benchmarks/mongodb.ts index f54ce5c..93650c4 100644 --- a/benchmarks/mongodb.ts +++ b/benchmarks/mongodb.ts @@ -1,4 +1,4 @@ -/// +/// import Iridium = require('../index'); import Bluebird = require('bluebird'); import MongoDB = require('mongodb'); @@ -14,8 +14,14 @@ interface UserDocument { class User { _id: string; + + static collection = "user"; + static schema = { + _id: true + }; } +@Iridium.Collection("userWrapped") class WrappedUser extends Iridium.Instance { _id: string; } @@ -25,13 +31,8 @@ class IridiumDB extends Iridium.Core { super({ database: 'test' }); } - User = new Iridium.Model(this,(model, doc) => doc, 'iridium', { - _id: false - }); - - UserWrapped = new Iridium.Model(this, WrappedUser, 'iridiumWrapped', { - _id: false - }); + User = new Iridium.Model(this, User); + UserWrapped = new Iridium.Model(this, WrappedUser); } console.log("Running benchmark with intensity of %d, %d samples", intensity, samples); diff --git a/benchmarks/tsconfig.json b/benchmarks/tsconfig.json new file mode 100644 index 0000000..bcbc4b4 --- /dev/null +++ b/benchmarks/tsconfig.json @@ -0,0 +1,10 @@ +{ + "compilerOptions": { + "target": "ES5", + "module": "commonjs", + "experimentalDecorators": true + }, + "files": [ + "mongodb.ts" + ] +} \ No newline at end of file