简体   繁体   English

orion 上下文代理在一次调用中删除多个实体

[英]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.我要删除所有实体 /v2/entities?type=person 我不想一一做。

In SQL it will look like在 SQL 中它看起来像

DELETE from person从人中删除

Currently I can delete only one entity per call with this: DELETE /v2/entities/{id}?type={entityType}目前,我每次调用只能删除一个实体: 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.但是,您需要知道要删除的特定实体 ID。

Deteling all the entities of a given type is not currently supported in the Orion API, but it is in our roadmap. Orion API 目前不支持删除给定类型的所有实体,但在我们的路线图中。 If you are interested in this functionality and what to show your support, please give it a +1 to the github issue about it .如果您对此功能感兴趣,以及如何表示您的支持,请在 github 问题上给它一个 +1。

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):作为解决方法,如果您有权访问 Orion 使用的 MongoDB 实例,您可以执行以下操作来删除给定类型的所有实体(假设您使用orion作为 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).编辑:以下脚本可用于通过 NGSIv2 API(即无需直接访问 DB)在 Orion 删除所有实体(给定类型和/或匹配给定过滤器)。

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

Use it with care ;)小心使用它;)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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