Restheart how to delete an aggregration

149 Views Asked by At

I have a number of aggregations defined in my mongodb instance and I would like to delete one of them.

So for example if I had 3 defined in the collections _properties metadata and I wanted to get rid of the second one how would I do it.

1

There are 1 best solutions below

1
On BEST ANSWER

to create an aggregation you define the aggrs array as a collection property.

PATCH /db/coll {"aggrs": [ {<aggr1>}, {<aggr2>}, {<aggr3>} ] }

to delete one you just need to update the aggrs property

PATCH /db/coll {"aggrs": [ {<aggr1>}, {<aggr3>} ] }

you can also use the $pull array update operator:

PATCH /db/coll {"$pull": { "aggrs": { "uri": "mySecondAgg" } } }