I created a JS logger application in Sails.js and everything looks great. Now I'm going to scale the application: I need to use several tables for the same model (for example, a table for session1 sesson2 , etc. Based on id).
Let's say that for the "Pageview" model, I will use different tables, such as "Pageview1", "Pageview2", etc.
How can I dynamically determine the table name of this model, so I can change it for each query according to a parameter or attribute.
So far i tried this way
var tableId = 2; Pageview.tableName = "pageview" + tableId; Pageview.create(values, function...);
This code does not interrupt the application or cause any errors, but the record was saved in the default table, not the one I wanted.
source share