derbyjs / racer

Realtime model synchronization engine for Node.js
1.19k stars 118 forks source link

New queries not working. #21

Closed juzerali closed 12 years ago

juzerali commented 12 years ago

I have got following code:

store.query.expose('users', 'potentialWinners', function(min){
    return this.where('bid').gte(1).sort(['bid', 'asc']);
});

var query = model.query('users').potentialWinners(1);

So far so good, but as soon as I try to fetch something with this query, I get an ugly error.

model.fetch(query, function(e, pw){
    console.log(pw.get());
});

Here is the error from console

TypeError: Cannot read property 'query' of undefined

poorg commented 12 years ago

yep, I'm seeing the same issue. Tried with scoped models, db backed stores etc. Essentially the QueryRegistry doesn't seem to have any queries in it when asked to lookup the queryTuple. As far as I can see the registerQuery method of query.Model is not being called.

juzerali commented 12 years ago

I don't really know what has changed. But it seems to be working now.