0

I am struggling to query on a json object inside an array of json objets, is this possible? if not any alternatives you would recommend?

availability : [{
              date: date,
              times: [{
                start:timeAvail[timeStart],
                end: timeAvail[timeEnd]
              }]
            }]; 

I want to query on date to get all objects with a certain date and get the array of all objects that match like [{date: x, time: [y]}] I've tried this but doesn't return:

Collection.find({availability: {$in: [{date: "2016/10/2"}]}}).fetch()

1 Answer 1

3
Collection.find({'availability.date': {$eq: new Date("2016/10/02").toISOString}}).fetch()

should do the trick.

Sign up to request clarification or add additional context in comments.

2 Comments

Awesome, thanks! Is there anyway to have it return only the date & times elements matched instead of the whole tuple?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.