You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was using RethinkDB in my last project, with JSData because it offers a great and simple API.
Like another DB's, rethinkdb doenst support unique constraints, and the developers comunity are adding a workaround to support this. My suggestion here is add a wrapper the create function with some like this:
constadapter=newRethinkDBAdapter();(adapterasany).createFn=adapter.create;adapter.create=asyncfunction(mapper,props,opts){for(constfieldof(mapperasany).schema.unique){if(!(await(adapterasany).r.table(mapper.name).getAll(props[field],{index: field}).isEmpty()))thrownewError(`Unique constraint violated on field { ${field}: ${props[field]} }`);}returnawait(adapterasany).createFn(mapper,props,opts);};
The text was updated successfully, but these errors were encountered:
I was using RethinkDB in my last project, with JSData because it offers a great and simple API.
Like another DB's, rethinkdb doenst support
unique
constraints, and the developers comunity are adding a workaround to support this. My suggestion here is add a wrapper the create function with some like this:The text was updated successfully, but these errors were encountered: