# MongoDB Input threw an exception, restarting {:exception=\>#\<BSON::ObjectId::Invalid: '2221275031010008292CAInvoiceCCEPrimary' is an invalid ObjectId.\>}

**URL:** https://discuss.elastic.co/t/mongodb-input-threw-an-exception-restarting-exception-bson-2221275031010008292cainvoicecceprimary-is-an-invalid-objectid/271932
**Category:** Logstash
**Created:** [May 3, 2021, 6:26am UTC](https://discuss.elastic.co/t/mongodb-input-threw-an-exception-restarting-exception-bson-2221275031010008292cainvoicecceprimary-is-an-invalid-objectid/271932 "2021-05-03T06:26:17Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![BASHEER\_DS](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/basheer_ds/32/88104_2.png) [@BASHEER\_DS](https://discuss.elastic.co/u/BASHEER_DS)
#### Post date: [May 3, 2021, 6:26am UTC](https://discuss.elastic.co/t/mongodb-input-threw-an-exception-restarting-exception-bson-2221275031010008292cainvoicecceprimary-is-an-invalid-objectid/271932/1 "2021-05-03T06:26:17Z")

</div>

Hi,

I am getting below error while creating pipeline. please help in resolving this error.

MongoDB Input threw an exception, restarting {:exception=\>#\<BSON::ObjectId::Invalid: '2221275031010008292CAInvoiceCCEPrimary' is an invalid ObjectId.\>}

Thanks and Regards.

---

<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: [May 3, 2021, 2:48pm UTC](https://discuss.elastic.co/t/mongodb-input-threw-an-exception-restarting-exception-bson-2221275031010008292cainvoicecceprimary-is-an-invalid-objectid/271932/2 "2021-05-03T14:48:29Z")

</div>

Is there a stack trace for that?

---

<div class="post-metadata">

### Author: ![BASHEER\_DS](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/basheer_ds/32/88104_2.png) [@BASHEER\_DS](https://discuss.elastic.co/u/BASHEER_DS)
#### Post date: [May 3, 2021, 2:53pm UTC](https://discuss.elastic.co/t/mongodb-input-threw-an-exception-restarting-exception-bson-2221275031010008292cainvoicecceprimary-is-an-invalid-objectid/271932/3 "2021-05-03T14:53:46Z")

</div>

> [@BASHEER\_DS](#):
>
> 2221275031010008292CAInvoiceCCEPrimary

@Badger No there is no stack trace. am using 3rd party logstash-input-mongo plugin

---

<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: [May 3, 2021, 4:10pm UTC](https://discuss.elastic.co/t/mongodb-input-threw-an-exception-restarting-exception-bson-2221275031010008292cainvoicecceprimary-is-an-invalid-objectid/271932/4 "2021-05-03T16:10:41Z")

</div>

I would expect an [objectId](https://docs.mongodb.com/manual/reference/method/ObjectId/) to be a hex string. If you set --log.level debug you will get some additional messages which may help you understand where that value is coming from.

---

<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 31, 2021, 4:11pm UTC](https://discuss.elastic.co/t/mongodb-input-threw-an-exception-restarting-exception-bson-2221275031010008292cainvoicecceprimary-is-an-invalid-objectid/271932/5 "2021-05-31T16:11:23Z")

</div>

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