1602 / jugglingdb

Multi-database ORM for nodejs: redis, mongodb, mysql, sqlite3, postgresql, arango, in-memory...
http://1602.github.io/jugglingdb/
2.04k stars 241 forks source link

Can't execute raw queries on the databases #316

Closed tolgaek closed 11 years ago

tolgaek commented 11 years ago

ORM can only take you so far before you need to execute some raw queries for optimizations..

Is this a feature that should be implemented?

dgsan commented 11 years ago

I think you can probably use schema.adapter.query if you really feel like it, at least with the mysql adapter.

1602 commented 11 years ago

@dgsan yep, correct.

sourcec0de commented 10 years ago

I am not able to access the adapter method on the schema, it only has validations hooks and basic query methods. Can anyone confirm this is still how you get direct access to the query?

schema.adapter.query(sql, function (err, data) {
    // etc ...
});

I am trying to do a basic autocomplete using a query like this.

SELECT * FROM table WHERE name LIKE 'sanitizedInput%'

ive tried

{
    where:{
        name:{
            like: input
        }
    }
}