Here's the code:
start = 0; end = 24
var updateQuery = schema.find({ account: accountID });
updateQuery.where( 'hour' ).gt( start ).lt( end );
updateQuery.exec( ...
This works fine if hour would be a number. In fact, it's an array holding objects with a value and an updatedBy key:
[{ value: 23, updatedBy: 'o45h43o8' }, ...]
Now, I want to combine the where-query with $elemMatch to find out, if hour[0].value is between start and end. Is this doable?
Update: Clarified my question.
You don't need to use $elemMatch for that, you can do it using dot notation like this:
updateQuery.where( 'hour.0.value' ).gt( start ).lt( end );