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

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

问题描述

我想删除MongoDB数据库的一些集合:db['mycollection'].remove({}),我发现有一个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实际上并不删除集合,而是删除所提供集合中的文档.查看处理器的文档

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 Mode设置为,则可以擦除配置的集合中的整个文档集合. 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天全站免登陆