Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nested AND for model.find #427

Closed
gileze33 opened this issue Jan 17, 2014 · 1 comment
Closed

Nested AND for model.find #427

gileze33 opened this issue Jan 17, 2014 · 1 comment

Comments

@gileze33
Copy link

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?

@dxg
Copy link
Collaborator

dxg commented Apr 8, 2014

Does #365 help?

@dresende dresende closed this as completed Sep 3, 2014
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

No branches or pull requests

3 participants