derbyjs / racer

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

Can't set reference model #41

Closed switz closed 12 years ago

switz commented 12 years ago

This is a derby app:

I am fetching a query of docs and then filtering it. If it has audioOnly it goes into

model.ref '_audioVideos', videoModel.filter({where:{'audioOnly': true}})

, and if not it goes into

model.set '_videos', videoModel.filter({where:{'audioOnly':false}}).get()

This works great, but later, I try to set something on '_audioVideos' through an x-bind. According to the derby docs ("Setting a property of the reference path modifies the underlying data"), I should be able to do this, but I get an error. I'm simply trying to set an existing field from false to true.

Console test:

> model.set('_audioVideos.0.report', true)
Error: set on undefined refList child _$queries._3.results.4fb0694edd78bc5ad304785a.report

It looks as though Racer is checking for the _id when it should be using the index. Should be: _$queries._3.results.3.report

switz commented 12 years ago

Closing as I investigate a bit further.