Docs Menu

Structured Streaming with MongoDB

On this page

  • Overview
  • Configuring a Write Stream to MongoDB
  • Configuring a Read Stream from MongoDB
  • Examples
  • Stream to MongoDB from a CSV File
  • Stream to a CSV File from MongoDB

Spark Structured Streaming is a data stream processing engine you can use through the Dataset or DataFrame API. The MongoDB Spark Connector enables you to stream to and from MongoDB using Spark Structured Streaming.

Important

Spark Structured Streaming and Spark Streaming with DStreams are different.

To learn more about Structured Streaming, see the Spark Programming Guide.

Reading a stream from a MongoDB database requires continuous processing, an experimental feature introduced in Spark version 2.3. To learn more about continuous processing, see the Spark documentation.

The following examples show Spark Structured Streaming configurations for streaming between MongoDB and a .csv file.

←  Read from MongoDBFAQ →

Select your language

Give Feedback
© 2022 MongoDB, Inc.

About

  • Careers
  • Investor Relations
  • Legal Notices
  • Privacy Notices
  • Security Information
  • Trust Center
© 2022 MongoDB, Inc.