Page 1 of 1

collname error when the field is not mandatory

Posted: Mon Feb 29, 2016 12:36 am
by Leonardo Valentin Zeferino

Hi!

I have a form with a select field not mandatory that have a pointer id to a collection "A" as value. This data will be inserted in another collection "B". When the user sends the form with no value selected in this field, appears the error "{"code":"DBSC231","description":"'_id' is missing for pointer column 'roast_id"}" because the "collname" field is already filled by me in the mapping data.

I suppose that the "collname" field only can be filled when a value is selected but I don't know how could I do this.

Could you help me?

Thanks.


collname error when the field is not mandatory

Posted: Mon Feb 29, 2016 9:04 am
by Serhii Kulibaba

Hello,

It is not allowed to fill only one field (collName) and leave another empty (_id).
Please add mapping to the column field instead of _id:
Image

And add there JS code below: prereturn (value) ? {_id : value, collName: "companies"} : null;/pre


collname error when the field is not mandatory

Posted: Tue Mar 01, 2016 11:58 am
by Leonardo Valentin Zeferino

Perfect!

Thanks