apache / apache/beam

[Feature Request] Write to dynamic collection in MongoDB, with the Apache Beam SDK in Python:

Open
#24,122 1 comment 0 reactions 0 assignees View on GitHub
io mongodb new feature P2 python
Dominant language
Java
Stars
8.7k
Forks
4.7k
Avg merge
1d 20h
Merged PRs (30d)
196

Description

### What would you like to happen?

I have a query with the coll parameter in apache_beam.io.WriteToMongoDB

```
Pcoll
| "Write to Mongo" >> apache_beam.io.WriteToMongoDB(
uri='someUri',
db='someDb',
coll='someColl',
batch_size=10
)
```

I would like to like to set the collection name dynamically based on the record, instead of hard coding it. For ex. if the record is dict. and if it has something like record.tag = 'example', I would like to retreive that and set as coll.

I got some similar references for BigQuery and tried coll = lambda record: record.tag, which doesn't work. It threw an error saying it needs a string.

### Issue Priority

Priority: 2

### Issue Component

Component: io-py-mongodb

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.