I'm trying to create a new Document with a ref to a Document of the same type (Content sites, which can have childrens or parents of each other). I'm getting the following error message:
description: 'document is not unique.',requestResult: RequestResult {
method: 'POST',
path: '',
query: null,
requestRaw: '{"create":{"collection":"Content"},"params":{"object":{"data":{"object":{"title":"Neu 3","content":"<p>Content</p>","type":{"ref":{"collection":"ContentType"},"id":"340867692647940301"},"author":{"ref":{"collection":"User"},"id":"337159230796595404"},"date":"2022-09-05","time":"20:16","published":true,"parent":{"ref":{"collection":"Content"},"id":"341985613786906830"}}}}}}',
requestContent: Expr { raw: [Object] },
responseRaw: '{\n' +
' "errors": [\n' +
' {\n' +
' "position": [ "create" ],\n' +
' "code": "instance not unique",\n' +
' "description": "document is not unique."\n' +
' }\n' +
' ]\n' +
'}\n',
This is my GraphQL schema:
...
type Content {
title: String
content: String
type: ContentType @relation
author: User @relation
date: String
time: String
published: Boolean
parent: Content
visibility: ContentVisibility @relation
revisions: [ContentRevision] @relation
}
...
and here is my FQL part:
q.Create(q.Collection("Content"), {
data: {
title: title,
content: content,
type: q.Ref(q.Collection("ContentType"), type),
author: q.Ref(q.Collection("User"), author),
date: date,
time: time,
published: published,
parent: q.Ref(q.Collection("Content"), parent)
}
})
The idea is, to create subpages:
Site-1 (type: Content)
- Site-2 (type: Content)
- Site-3 (type: Content)
I have no idea what's going wrong here - type and author is working, why the parent not?
Thanks