# Sync Data Mongo

**URL:** <https://discuss.elastic.co/t/sync-data-mongo/356698>\
**Category:** Logstash\
**Created:** [April 3, 2024, 2:51pm UTC](https://discuss.elastic.co/t/sync-data-mongo/356698 "2024-04-03T14:51:06Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![hoang\_van\_th\_ng](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hoang_van_th_ng/32/131157_2.png) [@hoang\_van\_th\_ng](https://discuss.elastic.co/u/hoang_van_th_ng)\
**Post date:** [April 3, 2024, 2:51pm UTC](https://discuss.elastic.co/t/sync-data-mongo/356698/1 "2024-04-03T14:51:06Z")

</div>

![image](https://us1.discourse-cdn.com/elastic/original/3X/8/6/869a80dcea6ae560c384fafdeaf8a41e900b6f46.png)  
I have that error in logstash logs when logstash starting. Here my config file for logstash:  
input {  
mongodb {  
uri =\> 'mongodb://shardsvr1:27017,shardsvr2:27017,shardsvr3:27017/db\_mongo?replicaSet=RplS'  
placeholder\_db\_dir =\> '/opt/logstash-mongodb/'  
placeholder\_db\_name =\> 'logstash\_sqlite\_backup\_.db'  
collection =\> "log\_history\_control\_\d{4}-\d{2}$"  
batch\_size =\> 10000  
}  
}

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [April 3, 2024, 6:14pm UTC](https://discuss.elastic.co/t/sync-data-mongo/356698/2 "2024-04-03T18:14:15Z")

</div>

Please do not post pictures of text. They are not searchable and some folks cannot read them.

The code is blowing up [here](https://github.com/phutchins/logstash-input-mongodb/blob/097cc9be8bb57754ec4006e174f0cb5cf3ff6b65/lib/logstash/inputs/mongodb.rb#L99). I think the find is returning nil, which probably means the collection is empty.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [May 1, 2024, 6:15pm UTC](https://discuss.elastic.co/t/sync-data-mongo/356698/3 "2024-05-01T18:15:03Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
