Leonardo Valentin Zeferino
Posts: 0
Joined: Fri May 29, 2015 2:07 pm

collname error when the field is not mandatory

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.

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

collname error when the field is not mandatory

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

Return to “Issues”