aboutsummaryrefslogtreecommitdiff
path: root/src/fields/DocumentReference.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/fields/DocumentReference.ts')
-rw-r--r--src/fields/DocumentReference.ts24
1 files changed, 20 insertions, 4 deletions
diff --git a/src/fields/DocumentReference.ts b/src/fields/DocumentReference.ts
index 10dac9f92..9d3c209b4 100644
--- a/src/fields/DocumentReference.ts
+++ b/src/fields/DocumentReference.ts
@@ -1,6 +1,8 @@
-import { Field, Opt } from "./Field";
+import { Field, Opt, FieldValue, FieldId } from "./Field";
import { Document } from "./Document";
import { Key } from "./Key";
+import { Types } from "../server/Message";
+import { ObjectID } from "bson";
export class DocumentReference extends Field {
get Key(): Key {
@@ -15,12 +17,16 @@ export class DocumentReference extends Field {
super();
}
- Dereference(): Opt<Field> {
+ UpdateFromServer() {
+
+ }
+
+ Dereference(): FieldValue<Field> {
return this.document.Get(this.key);
}
- DereferenceToRoot(): Opt<Field> {
- let field: Opt<Field> = this;
+ DereferenceToRoot(): FieldValue<Field> {
+ let field: FieldValue<Field> = this;
while (field instanceof DocumentReference) {
field = field.Dereference();
}
@@ -37,5 +43,15 @@ export class DocumentReference extends Field {
throw new Error("Method not implemented.");
}
+ ToScriptString(): string {
+ return "";
+ }
+ ToJson(): { type: Types, data: FieldId, _id: string } {
+ return {
+ type: Types.DocumentReference,
+ data: this.document.Id,
+ _id: this.Id
+ }
+ }
} \ No newline at end of file