geddy / model

Datastore-agnostic ORM in JavaScript
265 stars 55 forks source link

query with multiple equal operators fails #135

Closed der-On closed 10 years ago

der-On commented 10 years ago

Works:

model.SomeModel.first({someProp: { eql: 'somevalue'}, someOtherProp: { eql: 'somothervalue'}})

Fails:

model.SomeModel.first({someProp: 'somevalue', someOtherProp: 'somothervalue'})

I thought "eql" is the default? It works if only providing one single query parameter without a comparison operator, but not with multiple.

mde commented 10 years ago

Could you provide a little more context about how it fails? I've just added a test to master branch that does this:

https://github.com/mde/model/blob/master/test/integration/adapters/shared.js#L61

first queries are run the same way as all queries, and this syntax has historically always worked.

der-On commented 10 years ago

I'm using a date object as the first property. So it looks like:

model.Payment.first({date: new Date(), title: 'someTitle'})

mde commented 10 years ago

That was just the bit of information I needed. The code was assuming any object was a query object -- I wasn't filtering out Date and Boolean. This is fixed in 79ed9a726ffd18f2b14d022cec1449697490340f.