Assuming in your first example you meant

    query.$pull[team] = userId;

not

    query[team] = userId;

then your second example is already valid a ES6 computed property and does
exactly what you appear to be looking for.

On Sun, Jul 23, 2017 at 8:15 PM, Sebastian Malton <sebast...@malton.name>
wrote:

> When creating objects I think that having some notation to make the
> following easier to read
>
> let query = {
>     $pull: {}
> };
> query[team] = userId;
>
> I was thinking of borrowing from the above notation and doing the
> following:
>
> let query = {
>     $pull: {
>         [team]: userId
>     }
> };
>
> _______________________________________________
> es-discuss mailing list
> es-discuss@mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
>
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to