Skip to content

Conversation

@dxg
Copy link
Collaborator

@dxg dxg commented Jul 17, 2013

Enables:

Person.find({ age: 18 }).where("LOWER(surname) LIKE ?", ['dea%']).all( ... );
Person.find({ age: 18 }).find("LOWER(surname) LIKE ?", ['dea%']).all( ... );
Person.find({ age: 18, __sql: [["LOWER(surname) LIKE ?", ['dea%']]] }, function (err, items) { ... });

but I think we should only document the first version.

I named the key __sql to avoid any collisions with user specified model properties.

This addresses #225 and depends on dresende/node-sql-query#16 (I think tests will fail until that version of sql query is published).

@dresende
Copy link
Owner

You could pass __sql in the options instead of conditions. This would avoid collisions. About only documenting the first one, I agree.

@dresende
Copy link
Owner

It actually doesn't matter since sql-query is accepting it in conditions :)

@dresende
Copy link
Owner

I just merged and published new sql-query version.

@dresende
Copy link
Owner

It's just missing documentation :)

@dxg
Copy link
Collaborator Author

dxg commented Jul 17, 2013

I'll add doco and merge :)

dxg added a commit that referenced this pull request Jul 18, 2013
Allow querying chainfind with sql conditions, closes #225
@dxg dxg merged commit 5c6c1ea into master Jul 18, 2013
@dxg dxg deleted the find-sql branch July 18, 2013 00:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants