persistence.js is an asynchronous Javascript database mapper library. You can use it in the browser, as well on the server (and you can share data models between them).
I'm working with the sample code, specifically prefetching relationships.
This works:
var allTasks = Task.all(session).prefetch("category");
But this does not work:
var allTasks = Task.all(session).prefetch("tags");
node_modules/persistencejs/lib/persistence.store.sql.js:653
var thisMeta = meta.hasOne[prefetchField].type.meta;
^
TypeError: Cannot read property 'type' of undefined
I see the documentation says
"prefetch(rel)
Returns a new QueryCollection that prefetches entities linked through relationship rel, note that this only works for one-to-one and many-to-one relationships."
Does that mean that given a child you can get the parent (e.g. given a task you can get the category), but given a parent you cannot get the children (given a category you cannot get the tasks)?
I'm working with the sample code, specifically prefetching relationships.
This works:
var allTasks = Task.all(session).prefetch("category");
But this does not work:
var allTasks = Task.all(session).prefetch("tags");
node_modules/persistencejs/lib/persistence.store.sql.js:653 var thisMeta = meta.hasOne[prefetchField].type.meta; ^ TypeError: Cannot read property 'type' of undefined
I see the documentation says
"prefetch(rel) Returns a new QueryCollection that prefetches entities linked through relationship rel, note that this only works for one-to-one and many-to-one relationships."
Does that mean that given a child you can get the parent (e.g. given a task you can get the category), but given a parent you cannot get the children (given a category you cannot get the tasks)?