# Sync data from MongoDB using logstash

**URL:** <https://discuss.elastic.co/t/sync-data-from-mongodb-using-logstash/275918>\
**Category:** Logstash\
**Created:** [June 15, 2021, 2:45am UTC](https://discuss.elastic.co/t/sync-data-from-mongodb-using-logstash/275918 "2021-06-15T02:45:24Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bach\_Tran](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bach_tran/32/79675_2.png) [@Bach\_Tran](https://discuss.elastic.co/u/Bach_Tran)\
**Post date:** [June 15, 2021, 2:45am UTC](https://discuss.elastic.co/t/sync-data-from-mongodb-using-logstash/275918/1 "2021-06-15T02:45:24Z")

</div>

I'm using Logstash 6.8.0 to push my Message collection to Elasticsearch 6.8.0. This is my logstash file:

```auto
input {
  jdbc {
    jdbc_connection_string => "jdbc:mongodb://127.0.0.1:27017/vnpost_chatdb"
    jdbc_driver_library => "C:/Users/victo/mongojdbc3.1.jar"
    jdbc_driver_class => "com.dbschema.MongoJdbcDriver"
    jdbc_user => "" 
    jdbc_password => ""
    schedule => "*/5 * * * * *"
    statement => "db.Message.find({},{'_id': false, 'createdAt': false})"
  }
}
output {
  elasticsearch {
    "hosts" => ["127.0.0.1:9200"]
    "index" => "message_mng"
    "document_type" => "message"
    "document_id" => "%{id}"
  }
}

```

After running the config file, I was able to create a index but there is no data available there. I also notice an error:  
`java.nio.file.NoSuchFileException: C:\Users\victo\.DbSchema\logs\MongoDbJdbcDriver.log.lck`

Can anyone help me with this? Thanks in advance!

---

<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:** [July 13, 2021, 2:45am UTC](https://discuss.elastic.co/t/sync-data-from-mongodb-using-logstash/275918/2 "2021-07-13T02:45:27Z")

</div>

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