Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/js-kyle/mongodb-changestream-demo

Demo repository for my talk on MongoDB Change Streams
https://github.com/js-kyle/mongodb-changestream-demo

Last synced: about 2 months ago
JSON representation

Demo repository for my talk on MongoDB Change Streams

Awesome Lists containing this project

README

        

# MongoDB Change Stream demo

## Setup

### Prerequisites

**Start MongoDB container using Docker**

```bash
docker run -d --rm -p 27017:27017 --name mongo1 mongo:7 mongod --replSet rs0 --bind_ip_all
```

**Configure MongoDB Replica Set**

```bash
docker exec mongo1 mongosh --quiet --eval "\
var rs = rs.initiate({\
'_id': 'rs0',\
'members': [{'_id': 0, 'host': 'localhost:27017'}]\
}).ok;\
print('Replica set init result', rs);
"
```

**Install Node.js dependencies**

```bash
yarn
```

**Run the Demo Change Stream**

```bash
yarn start
```

Seed the database and make updates using the VSCode MongoDB Playgrounds.

### Helpful links

- [MongoDB Change Streams overview](https://www.mongodb.com/docs/manual/changeStreams)
- [Change Streams basics](https://www.mongodb.com/basics/change-streams)