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
- functions domain error
I cannot set up the domain for function Iβm trying to add the domain api.example.com I can only use Cloudflare as the DNS provider because my domain provider do...
- Storage Bucket Permissions
Hey folks, when enabling CRUD on the bucket level for the role any, should the bucket be accessible when using a session client?
- Python function - error while creating /...
I have been trying to figure it out myself for the last 2 days. I have self-hosted appwrite instance, and I am running python 3.12 function. It works great up t...