Apache-Nifi:删除 MongoDB 集合 [英] Apache-Nifi : Delete MongoDB collections

查看:29
本文介绍了Apache-Nifi:删除 MongoDB 集合的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想删除一些集合:db['mycollection'].remove({}),在我的 MongoDB 数据库中,我发现有一个 deleteMongo 处理器,但我不知道如何使用它,因为我找不到示例.

I want to delete some collections : db['mycollection'].remove({}) ,of my MongoDB database, i found out that there is a deleteMongo processor but i don't know how to use it since i can't find examples.

那么,deleteMongo 处理器允许这样做吗?如果是这样,请你给我举个例子.

So, does deleteMongo processor allow to do this? if it does, can you show me an example please.

提前致谢!

推荐答案

DeleteMongo 实际上并不删除集合,而是删除提供的集合中的文档.查看处理器的文档 这里.它期望传入的 FlowFile 将查询作为其内容.您可以尝试的一个简单示例是:

The DeleteMongo doesn't actually delete collections, rather it deletes the documents in the provided collection. Take a look at the processor's documentation here. It expects the incoming FlowFile to have the query as its content. A quick example you could try is:

GenerateFlowFile -> DeleteMongo

配置 GenerateFlowFile 并提供 MongoDB 查询,例如 { "customer.name" : "Smith, John"} 并将其连接到 DeleteMongo.您必须使用数据库名称、连接字符串和集合名称配置 DeleteMongo.

Configure GenerateFlowFile and provide a MongoDB query, something like { "customer.name" : "Smith, John"} and connect it to DeleteMongo. You have to configure DeleteMongo with the database name, connection string and collection name.

话虽如此,它可能不适合您删除集合的要求,但从技术上讲,如果您的查询是 {},您可以从配置的集合中擦除整个文档集合DeleteMongo 处理器的删除模式设置为Delete Many

Having said that, it may not suit your requirement of dropping collections, but technically you can wipe the entire collection of documents from the configured collection, if your query is {} and the Delete Mode of DeleteMongo processor is set to Delete Many

这篇关于Apache-Nifi:删除 MongoDB 集合的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆