On Objection.js Documentation page the eager() method is marked as deprecated and they recommend to use withGraphFetched.And i'm currently following along some Objection.js tutorials to get to know the technology and have this Model ``` const { Model } = require("objection");// Import User class model for relationMappings() const User = require("./Users.js");class Todo extends Model{class Todo extends Model { static get tableName() { return "todos"; } // defines the relations to other models. static get relationMappings() { return { user: { relation: Model.BelongsToOneRelation, modelClass: User, join: { from: "todos.user_id", to: "users.id" } } }; } } ```Now, with eager() i know that i could to Todo.query.eager("user").then(todos=>console.log(todos));But based on the documentation, I should use something else. My issue is, i use a MySQL database which has nothing to do with graphs. Anyone who could help me out here?
Submitted April 02, 2020 at 11:35AM by Tanckom
No comments:
Post a Comment