We have seen how to trash or untrash an object.
If you use find query on a trashed object, it will not be shown in the result by default. But if you set includeTrashed
to true, the object will get retrieved in the result.
Now, let’s see how to use the parameter includeTrashed
.
-
includeTrashed
is false by default. -
find
does not return the objects which were trashed using thetrash
function. - If you set this parameter to true or use the
untrash
method thenfind
returns those objects.
Just like the previous post, we will work with the same ReadObject data type here.
type ReadObject {
field1: String
field2: Int
}
Sample Query – (includeTrashed:false)
{
find(type: ReadObject, arcql: "hypi.id = '01FH5MKT5ZXHA7KNKTAK48H6KP'",includeTrashed:false) {
edges {
cursor
node {
... on ReadObject {
hypi {
id
created
}
field1
field2
}
}
}
}
}
#result – The trashed object not shown
{
"data": {
"find": {
"edges": []
}
}
}
Sample Query – (includeTrashed:true)
{
find(type: ReadObject, arcql: "hypi.id = '01FH5MKT5ZXHA7KNKTAK48H6KP'",includeTrashed:true) {
edges {
cursor
node {
... on ReadObject {
hypi {
id
created
}
field1
field2
}
}
}
}
}
#result – The trashed object shown
{
"data": {
"find": {
"edges": [
{
"cursor": "01FH5MKT5ZXHA7KNKTAK48H6KP",
"node": {
"hypi": {
"id": "01FH5MKT5ZXHA7KNKTAK48H6KP",
"created": "2021-10-04T12:31:47Z"
},
"field1": "End to end encrypted secure Data storage",
"field2": 10
}
}
]
}
}
}
Check the POSTMAN collection for the hide or unhide trash
requests in different programming languages! Click </>
and choose the programming language of your choice.
Don’t forget to insert your own Authorization key and Hypi Domain under Headers to test the results!