1

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.

4

1 回答 1

1

访问控制 Api 在 0.5 版本的 Racer 中进行了更改,此处提到http://blog.derbyjs.com/2013/06/04/migrating-from-derby-0-dot-3-to-0-dot -5/

我还没有玩过太多的身份验证,但一个指针是查看 GitHub 上的 Auth 示例 - https://github.com/codeparty/derby-examples/tree/master/auth

于 2013-08-30T21:01:50.143 回答