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
- Authentication on custom Websocket Serve...
Hi, I want to use a custom Websocket Server (using Bun) for my application. However I cant really figure out authentication on custom servers. Session cookies ...
- Realtime: Listener not triggered on upda...
I self host appwrite 1.8.1. The genereal functionallity works fine. But my realtime subscription isn't updating. I see "Received heartbeat response from realtim...
- Realtime for files() works almost well, ...
I have been trying to make use of realtime, today (14.03.26) I have pulled all the latest versions of docker images, and sdk available. Whats working: - Conn...