cloudant_使用Node.js在Cloudant NoSQL数据库中进行批处理

本文介绍如何使用Node.js在Cloudant NoSQL数据库中进行批处理操作,详细解析了具体步骤和实现方法。
摘要由CSDN通过智能技术生成

cloudant

Batch processing is a method of running high-volume, repetitive data jobs and it drives many actions behind the scenes. This includes applying updates, processing data, integrating data from multiple sources, data extraction, and many more. In this article, we will discuss how to write a batch process for the Cloudant NoSQL database using nodejs.

乙 ATCH处理运行大批量,重复数据作业的方法,它驱动幕后许多行动。 这包括应用更新,处理数据,集成来自多个来源的数据,数据提取等等。 在本文中,我们将讨论如何使用nodejs为Cloudant NoSQL数据库编写批处理。

nodejs use an event-driven, asynchronous non-blocking I/O model. So, considering a scenario where thousands or even millions of records need to be processed or updated, it could impact database performance as it would almost simultaneously fire all the calls at once. In this article, we will discuss the ways to address this issue using nodejs synchronous mechanism along with Cloudant bulk API.

nodejs使用事件驱动的异步非阻塞I / O模型。 因此,考虑到需要处理或更新成千上万条记录的情况,这可能会影响数据库性能,因为它将几乎同时触发所有调用。 在本文中,我们将讨论使用nodejs同步机制以及Cloudant批量API解决此问题的方法。

To demonstrate batch processing with an example lets replicate “movies-demodatabase listed in examples.cloudant.com.

为了用示例演示批处理,让我们复制examples.cloudant.com中列出的“ movies-demo 数据库。

Refer the example here to setup database replication

请在此处参考示例 设置数据库复制

情境 (Scenario)

For this article, we will use the “movies-demo” database and update all the documents which are older than the year 2000, with a new attribute Old_movie:true using nodejs.

对于本文,我们将使用“电影演示”数据库并使用nodejs使用新属性Old_movie:true更新2000年以前的所有文档。

脚步 (Steps)

  1. Create a view in the “movies-demo” Cloudant database to filter out the documents which are older than the year 2000.

    在“电影演示” Cloudant数据库中创建一个视图,以过滤出早于2000年的文档。
  2. Write a nodejs script to add a new attribute Old_movie:true in all these documents selected by the view, in a synchronized manner.

    编写一个nodejs脚本,以同步方式在视图选择的所有这些文档中添加新属性Old_movie:true

  3. Improvise the node scri
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值