Skip to content

Nested AND for model.find #427

Closed
Closed

Description

@gileze33

I'm trying to use the following to perform an OR looking something like ((x>1 AND y<10 AND x<10) OR ......)

I've tried:

{
    worker: search.workers[i],
    or: [
        { //whole day is within availability
            start: orm.lte(search.startOfDay), 
            end: orm.gte(search.endOfDay) 
        }, 
        { //availability starts on this day but is longer than it
            start: orm.gte(search.startOfDay), 
            start: orm.lte(search.endOfDay), 
            end: orm.gte(search.endOfDay) 
        }, 
        { //availability ends on this day but it starts before it
            start: orm.lte(search.startOfDay), 
            end: orm.gte(search.startOfDay),
            end: orm.lte(search.endOfDay) 
        }, 
        { //availability start and end are within this day
            start: orm.gte(search.startOfDay), 
            end: orm.lte(search.endOfDay) 
        }
    ]
}

But obviously you can't set more than one property with the same name in javascript. If I put start: [], it'll try and do an IN rather than an AND.

Is there anyway round this?

Activity

  1. dxg commented on Apr 8, 2014

    @dxg
    Collaborator

    Does #365 help?

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions