aboutsummaryrefslogtreecommitdiff
path: root/src/database.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/database.ts')
-rw-r--r--src/database.ts41
1 files changed, 0 insertions, 41 deletions
diff --git a/src/database.ts b/src/database.ts
deleted file mode 100644
index a822b15bf..000000000
--- a/src/database.ts
+++ /dev/null
@@ -1,41 +0,0 @@
-import { action, configure } from 'mobx';
-import * as mongodb from 'mongodb';
-
-export class database {
- private MongoClient = mongodb.MongoClient;
- private url = 'mongodb://localhost:27017/website';
-
- public update(id: string, field: string, value: string) {
- this.MongoClient.connect(this.url, (err, db) => {
- let collection = db.db().collection('documents');
- collection.update({ "id": id }, { $set: { field: value } });
- db.close();
- });
- }
-
- public delete(id: string) {
- this.MongoClient.connect(this.url, (err, db) => {
- let collection = db.db().collection('documents');
- collection.remove({ "id": id });
- db.close();
- });
- }
-
- public insert(kvpairs: JSON) {
- this.MongoClient.connect(this.url, (err, db) => {
- let collection = db.db().collection('documents');
- collection.insert(kvpairs, () => { });
- db.close();
- });
- }
-
- public getDocument(id: string) {
- var result: Array<JSON>;
- this.MongoClient.connect(this.url, (err, db) => {
- let collection = db.db().collection('documents');
- collection.find({ "id": id }).toArray((err, db) => { result = db });
- db.close();
- return result[0];
- });
- }
-}