简体   繁体   中英

orion context broker delete several entities at one call

I want to DELETE all entities /v2/entities?type=person I do not want do it one by one.

In SQL it will look like

DELETE from person

Currently I can delete only one entity per call with this: DELETE /v2/entities/{id}?type={entityType}

How to delete everything?

You can use batch update to delete several entities at the same time. However, you need to know the particular entity ids to delete.

Deteling all the entities of a given type is not currently supported in the Orion API, but it is in our roadmap. If you are interested in this functionality and what to show your support, please give it a +1 to the github issue about it .

As workaround if you have access to the MongoDB instance used by Orion you can do the following operation to remove all entities of a given type (assuming you are using orion as DB):

echo 'db.entities.remove({"_id.type": "Person"})' | mongo orion --quiet

EDIT: the following script can be useful to delete all entities (of a given type and/or matching a given filter) at Orion through the NGSIv2 API (ie no need to have access to DB directly).

https://github.com/telefonicaid/fiware-orion/blob/master/scripts/utils/delete_entities.py

Use it with care ;)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM