Skip to main content

HI community,

In my system users can create their own fields and call it as they wish. The only restriction is using _ at the beginning because that’s how we represent the id of the data. Since every output trigger needs an id, I was just converting the _id to the id field, but this creates a conflict when a user has an id in their data. Like this:

{
_id: '123123',
id: '2'
}

My questions is if there is a good solution for solving this problem.

I was thinking about not using the _id for the output id but I wouldn’t use what to use instead.

Thank you! 

 

@Diego Orca 

Might not be the best solution but the simplest might be just to preserve the ‘id’ field to a new key prior to overwriting it with the ‘_id’ field?


I fixed the issue encapsulating the data into an object like this:

{
id: '1',
data:{
id: 'example1',
name: 'example'
}
}