I have a collection that has a relationship with 2 other collections. When I create a document from Appwrite console it works fine and it create the document. When I try to add a document from node-appwrite
I get a 500 Error
I have to import around 6000 records.
appwrite version: 1.5.5
node-appwrite version: 12.0.1
Code to create the relationships:
await database.createRelationshipAttribute(
"dbID",
"collectionID",
"663019ab000e3905b278",
"manyToOne",
true,
"presupuestos",
"cliente",
"setNull"
);
What's the schema of all your collections and the payload when creating the document?
discord is not allowing me to paste all of my collections in here, there are 9 collections. how I can show you the collections?
You can. It'll upload as a file
clientes
collection has 2600 documentos more or less
code to create the document
await database.createDocument(
databaseId,
collectionPresupuestos,
contrato.id,
{
cliente: presupuesto.cliente_id,
nombre_apellidos: presupuesto.nombre_apellidos,
telefono: presupuesto.telefono,
email: presupuesto.email,
servicio_contratado: presupuesto.servicio_contratado,
direccion: presupuesto.direccion,
localidad_id: presupuesto.localidad_id,
codigo_postal: presupuesto.codigo_postal,
pisos: presupuesto.pisos,
locales: presupuesto.locales,
parking: presupuesto.parking,
escaleras: presupuesto.escaleras,
precio_presupuesto: presupuesto.precio_presupuesto,
cliente_id: presupuesto.cliente_id,
contrato_id: presupuesto.contrato_id,
created_at: presupuesto.created_at,
updated_at: presupuesto.updated_at,
},
[
Permission.read(Role.user(presupuesto.cliente_id)),
Permission.update(Role.user(presupuesto.cliente_id)),
]
);
payload:
"presupuesto": {
"nombre_apellidos": "some name",
"telefono": "666666666",
"email": "test@test",
"servicio_contratado": "ite",
"direccion": "some adress",
"localidad_id": "{\"id\":\"328\",\"nombre\":\"Hospitalet de Llobregat, l'\",\"comarca_id\":\"13\"}",
"codigo_postal": "12345",
"pisos": 14,
"locales": 0,
"parking": "No",
"escaleras": "izquiera-derecha",
"precio_presupuesto": [
"{\"gastos_desplazamiento\":3000,\"gastos_servicio\":65000,\"gastos_parking\":0,\"gastos_tramitacion\":2500,\"total\":77500,\"total_con_iva\":93775,\"num_visitas\":1,\"num_entidades\":14,\"precio_hora_tecnico\":3500}"
],
"cliente_id": "1",
"contrato_id": "3",
"created_at": "2018-12-27T16:11:05.000Z",
"updated_at": "2019-01-24T17:23:34.000Z"
},
Recommended threads
- Having issues with login via CLI
``` ~/appwrite ξ° appwrite login --endpoint https://localhost/v1 --verbose ? Enter your email myvalidemai...
- Send Email Verification With REST
I am using REST to create a user on the server side after receiving form data from the client. After the account is successfully created i wanted to send the v...
- Use different email hosts for different ...
Hello, I have 2 projects and i want to be able to set up email templates in the projects. Both projects will have different email host configurations. I see ...