I had a weird issue. I've been using mongodb and mongoose for sometime and never had an array filtering. Today I had to do it and I'm stuck.
How do you access array stored in mondodb using the traditional way array[0]?
My array stored in my db as the following:
_id:6262013fa90e7b533809140d
isactive:true
schedule:Array
1:Object
2:Object
3:Object
4:Object
5:Object
6:Object
name:"whatever"
description:"describe somthing"
so many questions about mongoose arrays online and yet the doc is not showing any examples.
So now if I want to access the array schedule[0] value. How do I filter the find({"schedule[0]" : "object.name"})
Or how do you access arrays in general in Mongoose? The doc is so poor and no examples about it online.
How do I update schedule[2] or schedule[3] in that array using mongoose?
schedule[0] object has the following data:
0:Object
weekdayname:"Monday",weekdaynumber:1,
openhours:"10",
closehours:"10"
openminutes:"00"
closeminutes:"00"
openampm:"AM",closeampm:"PM"
to update schedule[0].openhours, what should I do?