Skip to content

using multiple 'or' clause ignores 2nd 'or' clause #5592

Description

@grd2345

when writing a query using multiple 'or' clauses, it will return the records that match the first 'or' clause and ignore the 2nd or clause. This is the code that I have attempted but doesnt work.

Employee.find()
   .where({  
   or:[  
      {  
         locationId:employee.currentLocation.id
      },
      {  
         facilityId:employee.facilityId,
         userName:employee.userName,
         accountOwner:true
      }
   ]
},
{  
   or:[  
      {  
         employeeId:{  
            startsWith:params.search.value
         }
      },
      {  
         fullName:{  
            startsWith:params.search.value
         }
      },
      {  
         street:{  
            startsWith:params.search.value
         }
      },
      {  
         emailAddress:{  
            startsWith:params.search.value
         }
      },
      {  
         employeeType:{  
            startsWith:params.search.value
         }
      },
      {  
         status:{  
            startsWith:params.search.value
         }
      }
   ]
})     

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions