Start a new topic
Answered

Query Collections for the current user

I'm trying to get the collection data of the current logged in user via the following query:


image





However, when executing, the app crashes with the following error:


Terminating app due to uncaught exception 'Invalid property name', reason: 'Property '_acl' not found in object of type 'Status''


How would I create a Query to check the ACL value is the currently logged in user?


Thanks!


Best Answer
Chris,

Please use the following:
"acl.creator == %@"

The acl property is mapped to the key "acl" on the client, not "_acl".

Thanks,
Pranav
Kinvey

 


Chris,

What version of the SDK are you using? Also can you share the definition of the Status class?

 

Thanks,
Pranav

Kinvey

Hi Pranav,


I'm using version 3.3.6.


Here is my Status class:


 

import Kinvey
import ObjectMapper

class Status: Entity {
    
    dynamic var user: String?
    dynamic var video1MetaData: String?
    dynamic var report: String?

    
    override class func collectionName() -> String {
        //return the name of the backend collection corresponding to this entity
        return "Status"
    }
    
    //Map properties in your backend collection to the members of this entity
    override func propertyMapping(_ map: Map) {
        //This maps the "_id", "_kmd" and "_acl" properties
        super.propertyMapping(map)
        //Each property in your entity should be mapped using the following scheme:
        //<member variable> <- ("<backend property>", map["<backend property>"])
        
        user <- ("user", map["user"])
        video1MetaData <- ("video1MetaData", map["video1MetaData"])
        report <- ("report", map["report"])

    }
}

 

Chris,

This has been escalated to engineering and will get back to you once I have more information.

Thanks,
Pranav
Kinvey Support
MLIBZ-1657

 

Answer
Chris,

Please use the following:
"acl.creator == %@"

The acl property is mapped to the key "acl" on the client, not "_acl".

Thanks,
Pranav
Kinvey

 

That worked! Thank you!

Login or Signup to post a comment