Hi,
Yes, it is possible to find document with multiple keys and values. You have to use FindDocumentByQuery for the same as follows:
let key1 = "name"
let value1 = "Nick"
let key2 = "age"
let value2 = 30
let query1 = QueryBuilder.buildQueryWithKey(key1, value: value1, andOperator:APP42_OP_EQUALS)
let query2 = QueryBuilder.buildQueryWithKey(key2, value: value2, andOperator:APP42_OP_EQUALS)
let query3 = QueryBuilder.combineQuery(query1, withQuery: query2, usingOperator: APP42_OP_AND)
storageService?.findDocumentsByQuery(query3,dbName:dbName, collectionName: collectionName, completionBlock: { (success, response, exception) -> Void in
if(success)
{
let storage = response as! Storage
NSLog("%@", storage.dbName)
NSLog("%@", storage.collectionName)
let jsonDocList = storage.jsonDocArray
for jsonDoc in jsonDocList {
NSLog("%@",jsonDoc.docId)
NSLog("%@",jsonDoc.createdAt)
NSLog("%@",jsonDoc.updatedAt)
NSLog("%@",jsonDoc.jsonDoc)
}
}
else
{
NSLog("%@", exception.reason!)
NSLog("%d", exception.appErrorCode)
NSLog("%d", exception.httpErrorCode)
}
})
Let me know if you have any further queries.