derbyjs / racer

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

id - confusion - byId() and where('_id')/where('id') .within([<id#1>, ...]) doens't return scoped model #27

Closed cjblomqvist closed 11 years ago

cjblomqvist commented 12 years ago

With new query system, most likely because ids are named ids as well as _ids, whenever you do:

store.query.expose('test', 'fromArrayOfIds', function( ids ) { return this.byId( ids ); // return this.where('_id').within( ids ); -- Will work exactly as above // return this.where('id').within( ids ); -- Won't work });

...

model.subscribe( model.query('test').fromArrayOfIds( my_array_of_ids ), function( err, scoped_tests ) {

console.log( model.get('test') ); // Returns array of test objects - ie. will return expected result console.log( scoped_tests.get() ); // Returns undefined - ie. won't return expected result

});

Probably related to the confusion mentioned in Issue #20

nateps commented 11 years ago

No longer relevant in 0.5