Hello,
I have a collection where I have 2 collection link attribute :
- objLink1
- objLink2
I want to get all collection item where objLink1 is set and objLink2 is not set.
Is i possible with filter ?
Thanks you.
Regards.
Hello,
I have a collection where I have 2 collection link attribute :
I want to get all collection item where objLink1 is set and objLink2 is not set.
Is i possible with filter ?
Thanks you.
Regards.
filter: {
objLink1:{$exists:true},
objLink2:{$exists:false}
}
Hello !
Thanks you, but, do you has the correct syntax with GET request like :
/api/collections/get/my-collection?filter[objLink1][$exists]=true
?
It’s seems not the good syntax.
Thanks you.
Regards.
@nkondratek did you find any solution?
I tried with fields
(instead collectionLink
), it’s not working. Could you post, if there is any other workaround?
When switching to a GET
query, true
/false
should be set as 1
/0
/api/collections/get/testcol1?filter[linked1][$exists]=1&filter[linked2][$exists]=0
linked1
and linked2
are the respective linked fields.
The results are correctly filtered, based on the fields being linked or not.
Still Cockpit tries everything to also read literal “true”/“false” strings in query strings correctly - so this works for me currently also with “true”/“false” but maybe 3 years ago it did not.
What exactly is not working for you @ChinkyPrinceCarey ? Testing for set fields ?
/api/collections/get/testcol1?filter[field1][$exists]=1
With field1
being a normal text field this filters correctly for entries with a value set for field1
.