-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How do i manage references? #10
Comments
Hi @apppro123
|
You have used insertedCalendars[0] in insertedEvents under Calendar: Is it possible to insert objects? Or is it just possible to insert insertedCalendars[0].id? |
I'm a bit confuse about the question, pls let me know if my answer isn't what you are looking for.
Just a head ups, data types will be updated in the next version, so "[]#Calendar" will be deprecated or invalid soon. Also, using lowercase for property name is more preferable. |
Thank you first. And ty for the tip with lowercase characters. |
You're welcome. Yes, you can pass either a // it will automatically get and replace the `id` from `insertedCalendars[0]`
Calendar: insertedCalendars[0] |
Ok thanks! |
No worries! |
I will close this issue since it has been resolved. Also, feel free to reopen or create a new one again |
Hi i have another question:
How do i manage references?
If i have two schemas and i reference one of the to the other, how to do i insert data to them?
Do i have to insert in both (and give the id of the "second" db to the first) or is it sufficient if i just insert the data into the "main" schema and insert the data of the refrenced element like the schema of the "second" db is built (as an object)?
f.e.
export class CalendarEventModel { name="CalendarEvent" props={Id: "int", Title: "string", Start: "datetime", End: "datetime", Calendar: "#Calendar"};
const CalendarSchema = {name: "Calendar", props: {Id: "int", Title:"string", Color:"string"}};
1.
Calendar.insert({Id: 1, Title:"CalendarExample", Color:"#FFFFFF"});
CalendarEvents.insert({Id: 1, Title: "example", Start: Moment(), End: Moment().add(5, "minutes"), Calendar: 1});
2.
CalendarEvent.insert({Id: 1, Title: "example", Start: Moment(), End: Moment().add(5, "minutes"), Calendar: {Id: 1, Title:"CalendarExample", Color:"#FFFFFF"}});
And which types does datetime take (only date() of js or also Moment.js objects)?
Thank you!
The text was updated successfully, but these errors were encountered: