derbyjs / racer

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

Query byId() reads in the entire collection from the db (mongodb) before selecting the one to return #58

Closed Ziink closed 11 years ago

Ziink commented 11 years ago

This is with 'racer-db-mongo'. Obviously this inefficient and could cause major problems.

switz commented 11 years ago

Did you try creating an index in your mongo database?

db.collection.ensureIndex( { "id": 1 }, {background: true})
Ziink commented 11 years ago

Yes, I was querying against the '_id' field which is the primary index. I think that's what byId() searches on.

nateps commented 11 years ago

No longer relevant in 0.5