derbyjs / racer

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

Error in multiple queries #35

Closed fjbsantiago closed 11 years ago

fjbsantiago commented 12 years ago

racer : 0.3.13 derby : 0.3.13 racer-db-mongo : 0.3.13

I have these queries.

peopleOlderThan = model.query('people').olderThan(50)
peopleFrom = model.query('people').from('Lisbon')

I subscribe them, in either of these ways:

model.subscribe peopleOlderThan, peopleFrom, (err, seniors, peopleFrom) -> 

or

model.subscribe peopleOlderThan, (err, seniors) -> 
        model.subscribe peopleFrom, (err, residents) -> 

When I subscribe them, I get the following error

C:\LogViewer\node_modules\derby\node_modules\racer\lib\descriptor\query\scope.js:187
      throw new Error('Uncaught edge case: ' + method + ' ' + require('util').
            ^
Error: Uncaught edge case: set { '0':
   [ 'people.502a5385769d510064000001',
     { name: 'Pedro Abrunhosa',
       age: 52,
       city: 'Lisbon',
       nif: '66666',
       id: 502a5385769d510064000001 } ],
  '1':
   { name: 'Pedro Abrunhosa',
     age: 52,
     city: 'Lisbon',
     id: 502a5385769d510064000001 } }
    at Model._1 (C:\LogViewer\node_modules\derby\node_modules\racer\lib\descriptor\query\scope.js:187:13)
    at Model.EventEmitter.emit (events.js:115:20)
    at Model.mixin.events.init.memory (C:\LogViewer\node_modules\derby\node_modules\racer\lib\refs\index.js:39:19)
    at Model.EventEmitter.emit (events.js:91:17)
    at Model.module.exports.proto._addData (C:\LogViewer\node_modules\derby\node_modules\racer\lib\descriptor\descriptor.Model.js:162:16)
    at module.exports.proto.subscribe (C:\LogViewer\node_modules\derby\node_modules\racer\lib\descriptor\descriptor.Model.js:87:14)
    at Object.module.exports.server._addSub._clientIdPromise.on.res.send (C:\LogViewer\node_modules\derby\node_modules\racer\lib\descriptor\descriptor.Model.js:208:13)
    at Object.module.exports.events.middleware.middleware.subscribe.add._res.send (C:\LogViewer\node_modules\derby\node_modules\racer\lib\pubSub\pubSub.Store.js:120:39)
    at Object.module.exports.events.middleware.middleware.fetch.add._res.send (C:\LogViewer\node_modules\derby\node_modules\racer\lib\descriptor\descriptor.Store.js:105:27)
    at module.exports.events.middleware.middleware.fetchQuery.add.store._fetchAndCompileQueryData.done (C:\LogViewer\node_modules\derby\node_modules\racer\lib\descriptor\query\query.Store.js:72:17)

C:\LogViewer>
switz commented 11 years ago

I've been getting this error too. Not sure exactly why it's happening, but it has something to do with the id property not being matched correctly. If you force the id toString() (scope.js) then this fixes the issue. The underlying issue is probably something I changed in my code, however. I'm going to keep digging around.

nateps commented 11 years ago

No longer relevant in 0.5