I want to extends query method of model, this is what i wrote:
store.query.expose('todos', 'forGroup', function(group) {
return this.where('group').equals(group);
});
but when i run the app, console says "Cannot call method expose of undefined", which means store.query is undefined.Why is that?
the store variable is:
var store = derby.createStore({
db: liveDbMongo(mongoUrl + '?auto_reconnect', {safe: true})
, redis: redis
});
And i also output the store using console.log:
{ domain: null,
_events: { client: [Function] },
_maxListeners: 10,
racer:
{ get: [Function],
_plugins: [ [Function: derbyServer] ],
run: [Function: run],
createApp: [Function: createApp],
createStatic: [Function: createStatic] },
modelOptions: undefined,
shareClient:
{ options: { db: [Object], redis: [Object] },
preValidate: undefined,
validate: undefined,
backend:
{ snapshotDb: [Object],
getOps: [Function],
publish: [Function],
submit: [Function],
_subscribeChannels: [Function],
subscribe: [Function],
fetch: [Function],
bulkFetchCached: [Function],
fetchAndSubscribe: [Function],
queryFetch: [Function],
query: [Function],
collection: [Function],
destroy: [Function] },
extensions: { '': [] },
docFilters: [],
opFilters: [] },
logger: undefined }
and console.log(store.query)
outputs undefined
.