Skip to content

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

Closed

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

  1. dresende commented on Aug 20, 2013

    @dresende
    Owner

    Try with sqlite3 2.1.7. We have issues from that version forward that are not resolved yet.

  2. added a commit that references this issue on Aug 20, 2013
  3. dresende commented on Aug 20, 2013

    @dresende
    Owner

    Please try the latest commit, don't forget to update dependencies.

  4. dresende commented on Aug 26, 2013

    @dresende
    Owner

    This should be fixed, reopen otherwise.

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