Skip to content

SQLite fails when trying to find with a boolean field #292

Description

@colegleason

I have a model with a boolean field running on an SQLite3 database.

If I try to use find like this:

db.models.endpoint.find({active: true}, function(err, endpoints) {                                                                                                            
    if (err) {                                                                                                                                                                
        console.log(err);                                                                                                                                                     
        done.abort();                                                                                                                                                         
    }                                                                                                                                                                         
    console.log(endpoints);                                                                                                                                                   
    done(endpoints);                                                                                                                                                          
});      

I get the error:

{ [Error: SQLITE_ERROR: no such column: true] errno: 1, code: 'SQLITE_ERROR' }

However, if I call find with an integer instead

db.models.endpoint.find({active: 1}, function(err, endpoints) {                                                                                                            
    if (err) {                                                                                                                                                                
        console.log(err);                                                                                                                                                     
        done.abort();                                                                                                                                                         
    }                                                                                                                                                                         
    console.log(endpoints);                                                                                                                                                   
    done(endpoints);                                                                                                                                                          
});

I get the results that I am expecting.

Node 0.10.9
sqlite3 2.1.14
orm 2.1.0

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions