Closed cjmyles closed 5 years ago
Hey!
Yes, I actually found a similar bug when working on #82 which itself is contained in #58. The problem is that fireorm doesn't know how to instantiate the custom Reference class returned by firestore and it throws an error.
The temporary/hack solution is to do something similar of what I did to support geopoints (which is using the @Type Decorator to tell fireorm how to parse the class, that's explained here). The long term solution is that fireorm know how to parse every firestore class and provide you a way to tell how to parse the things that it doesn't know, but that must wait until #58.
I have limited internet connectivity until the weekend, I'll check deeper then.
Hola! Thanks for the quick reply.
I'm happy with the temporary/hack solution, and seems like it should be easy enough to implement, however I'm still getting the same serialisation error with this code:
class Pillar { }
@Collection()
class Band {
id!: string;
name!: string;
formationYear!: number;
genres!: Array<string>;
@Type(() => Pillar) pillar!: Pillar;
}
Where pillar
is my Firebase reference to another collection. Any idea what I'm doing wrong?
Hey! I was quite busy last week, I'll try to take a look at this in the coming days :)
Hey!
I took a look at this issue and I'm afraid it'll a bit more cumbersome that I was expecting.
1st question: How do you add a "reference" field? I was looking in Firebase Console but "reference" is not inside the field types see image.
2nd Q: Adding a reference via the console makes the query to return a CollectionReference or a [Document Reference]()?
Hey, thanks for taking a look at this.
The "reference" type is actually underneath the "geopoint" entry in that dropdown - you just have to scroll down. Because the scrollbar isn't visible on chrome it isn't entirely obvious that it exists!
With regards to the reference, it's a DocumentReference type.
Oh, didn't see the scrollbar. Will check it again, thanks!
Hey! This was closed in #105. Now fireorm wont throw if it finds a DocumentReference! See the integration test to see how to use it!
PD. Don't forget to use @Type! (L11-12)
Amazing thanks dude! Quick work. Will check it out and let you know if I experience any issues.
Hey! This was closed in #105. Now fireorm wont throw if it finds a DocumentReference! See the integration test to see how to use it!
PD. Don't forget to use @type! (L11-12)
I'm sorry but I can't see it, please explain it in the documentation too.
Because my problem isn't still solved, I'm working with vue then it says Maximum call stack size exceeded
I know that there is a plan to add relationship support to Fireorm (https://github.com/wovalle/fireorm/issues/32), however I noticed that adding a reference to a document causes an error.
I copied the example from this Medium article as follows which works fine:
As soon as I go into the Firebase Console, locate this document and then add a new field which is a reference to another collection I get the following error:
Is this right, or is there any easy way to fix it? I have an existing Firestore database that contains references so I need Fireorm to fail gracefully with references until it's fully supported.
P.S I assume you are using TypeORM as a reference for adding entity relations?