aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--database.tsx15
1 files changed, 15 insertions, 0 deletions
diff --git a/database.tsx b/database.tsx
new file mode 100644
index 000000000..9c90326a5
--- /dev/null
+++ b/database.tsx
@@ -0,0 +1,15 @@
+import { action, configure } from 'mobx';
+import * as mongodb from 'mongodb';
+
+export class database {
+ private MongoClient = mongodb.MongoClient;
+ private url = 'mongodb://localhost:27017/website';
+
+ public async update(id: string, field: string, value: string) {
+ this.MongoClient.connect(this.url, (err, db) => {
+ let collection = db.collection('documents');
+ collection.update({ "id": id }, { $set: { field: value } });
+ db.close();
+ });
+ }
+}