Dynamic findOne().[key]


#1

Hello everyone!

I was wondering if there is a way adding dynamic key on the end of fineOne query? For example:

items() { return Labels.findOne({_id: this.companyId}).[dynamic key]; }

my collection structure:

_id: companyId,
dropdown1: [
{
_id: string,
name: string
},
{
_id: string,
name: string
}],
dropdown2: [
{
_id: string,
name: string
},
{
_id: string,
name: string
}]

Thanks!


#2

Okay guys sorry, I figured it out… No dot is needed.

findOne()[key]