diff options
author | yipstanley <stanley_yip@brown.edu> | 2019-02-13 16:38:09 -0500 |
---|---|---|
committer | yipstanley <stanley_yip@brown.edu> | 2019-02-13 16:38:09 -0500 |
commit | 430878f6dd8d36b1322e15d0898ada0d44fecacb (patch) | |
tree | 027fb9b578a3fee8d97b16922a930806da00afaa /src/fields/Document.ts | |
parent | 2eb147ab8f25e6dd90f47cf21499c7340642f0c9 (diff) |
Asdfjkla/sdfklj
Diffstat (limited to 'src/fields/Document.ts')
-rw-r--r-- | src/fields/Document.ts | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/fields/Document.ts b/src/fields/Document.ts index 99cd03813..56ac3c471 100644 --- a/src/fields/Document.ts +++ b/src/fields/Document.ts @@ -7,6 +7,8 @@ import { ListField } from "./ListField"; import { findDOMNode } from "react-dom"; import { Server } from "../client/Server"; import { Types } from "../server/Message"; +import { ObjectID } from "bson"; +import { Utils } from "../Utils"; export class Document extends Field { public fields: ObservableMap<Key, Opt<Field>> = new ObservableMap(); @@ -87,11 +89,12 @@ export class Document extends Field { Set(key: Key, field: Field | undefined): void { if (field) { this.fields.set(key, field); - Server.AddDocumentField(this, key, field); + // Server.AddDocumentField(this, key, field); } else { this.fields.delete(key); - Server.DeleteDocumentField(this, key); + // Server.DeleteDocumentField(this, key); } + Server.UpdateField(this); } @action @@ -101,7 +104,7 @@ export class Document extends Field { //if (field != WAITING) { // do we want to wait for the field to come back from the server to set it, or do we overwrite? if (field instanceof ctor) { field.Data = value; - Server.SetFieldValue(field, value); + // Server.SetFieldValue(field, value); } else if (!field || replaceWrongType) { let newField = new ctor(); newField.Data = value; @@ -156,7 +159,7 @@ export class Document extends Field { throw new Error("Method not implemented."); } - ToJson(): { type: Types, data: [string, string][], id: string } { + ToJson(): { type: Types, data: [string, string][], _id: ObjectID } { let fields: [string, string][] = [] this._proxies.forEach((field, key) => { if (field) { @@ -167,7 +170,7 @@ export class Document extends Field { return { type: Types.Document, data: fields, - id: this.Id as string + _id: this.Id } } |