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
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