HI have trouble finding out how mongo works when trying to find data that have to match in nested arrays
This dont work:
db.getCollection('events').findOne(
{'_id' : "9vCTF9XsTBodW4AL9", manydates: { "$elemMatch" : { dateid:"2019-05-09", $.voters : "CmfEWTxN7GZbKQKfY"} } }
)
I think the rest will work if I can get the DB Find correct.
<v-checkbox v-on:change="checkDates(`${datelist.dateid}`, $event)" style="flex-wrap:nowrap;" v-model="checkthedates" :label="`Vælg`" :value="`${datelist.dateid}`"></v-checkbox>
mounted () {
const mongoDataSteps = Events.findOne(
{_id: this.$route.params.eventId}
);
console.log(mongoDataSteps.manydates);
this.checkthedates = mongoDataSteps.manydates;
},
{
"_id" : "9vCTF9XsTBodW4AL9",
"name" : "many dates works",
"manydates" : [
{
"dateid" : "2019-05-09",
"datenew" : "2019-05-09",
"datestarttime" : "",
"dateendtime" : "",
"voters" : [
[
"CmfEWTxN7GZbKQKfY"
]
]
},
{
"dateid" : "2019-05-22",
"datenew" : "2019-05-22",
"datestarttime" : "",
"dateendtime" : "",
"voters" : [
[
"CmfEWTxN7GZbKQKfY",
"sdfsdfsdfsdf",
"asdasd"
]
]
},
{
"dateid" : "2019-05-03",
"datenew" : "2019-05-03",
"datestarttime" : "",
"dateendtime" : "",
"voters" : [
[
"CmfEWTxN7GZbKQKfY"
]
]
},
{
"dateid" : "2019-05-0306:30",
"datenew" : "2019-05-03",
"datestarttime" : "06:30",
"dateendtime" : "",
"voters" : []
}
]
}