aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoraahmed98 <43424656+aahmed98@users.noreply.github.com>2019-02-09 15:26:57 -0500
committerGitHub <noreply@github.com>2019-02-09 15:26:57 -0500
commit5722979894b53805639407f856cea78a56d725f3 (patch)
tree7010198fe25053ee00dde19294d03855bb49cded
parentc1581aaf93467cce8fca8a3da71181d79b3bfef8 (diff)
Create database.tsx
-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();
+ });
+ }
+}