# MongodbWriter create ObjectId

**URL:** <https://forum.cloverdx.com/t/mongodbwriter-create-objectid/1954>\
**Category:** CloverDX Platform\
**Created:** [April 3, 2018, 12:00am UTC](https://forum.cloverdx.com/t/mongodbwriter-create-objectid/1954 "2018-04-03T00:00:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sshrestha](https://avatars.discourse-cdn.com/v4/letter/s/a183cd/32.png) [@sshrestha](https://forum.cloverdx.com/u/sshrestha)\
**Post date:** [April 3, 2018, 12:00am UTC](https://forum.cloverdx.com/t/mongodbwriter-create-objectid/1954/1 "2018-04-03T00:00:00Z")

</div>

Hi,

I am trying to insert a new row into MongoDB using Mongodb Writer. When inserting I also need to generate ObjectId (maybe datetime as well). How can I achieve this?

I tried the following json object below:

```auto

{
	"product_id": new ObjectId(),
	"name": "foo",
	"category": "bar"
}

```

The JSON object above throws JsonParseException. I also tried removing the “new” keyword but I ended up getting the same error.  
Is it not possible to do this in CloverETL?

Sincerely,  
Shubha

---

<div class="post-metadata">

**Author:** ![PedroVazquezRosario](https://avatars.discourse-cdn.com/v4/letter/p/ed8c4c/32.png) [@PedroVazquezRosario](https://forum.cloverdx.com/u/PedroVazquezRosario)\
**Post date:** [April 12, 2018, 12:05pm UTC](https://forum.cloverdx.com/t/mongodbwriter-create-objectid/1954/2 "2018-04-12T12:05:11Z")

</div>

Unfortunately, that function will not work in the MongoDBWriter component since we require Strict JSON mode. I would recommend using the builtin “\_id” field. All new object IDs in this field will be automatically generated when a new object is inserted.
