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:
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
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:
{
"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
-
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.
Please sign in to leave a comment.
Comments 1