Selecting a field that i don't know its name,but its name is stored in the document as value


I want to select “aname87” field but i don’t know its name,i only know that “name” field value,
has the name.

Is there a simple solution to make(construct) that reference to that field?

Something like that project("$" + $name) = project("$aname87")

“name” : “aname87” ,
“aname87” : “avalue”

Thank you

Which lab are trying to solve? I do not remember having to do that sort of thing. May be the developer’s forum is a better venue at for your question.

1 Like

It is not from a specific lab,its general question about selecting fields,thank you for the link

Hi @Takis,

I didn’t really understand the ask here. Can you please elaborate a little more on this ?

~ Shubham

This has been answered in the dev forum and involves $objectToArray.

Ah, I see.


ObjectToArray and back, is not enough,we need a way to refer to fields using variables.
If someone can answer this will be helpfull.

Thank you.