The sort field is not working in the go lang chain code.
Here is my query string:
queryString := `{
"selector": {
"dockType": {
"$or": [
"Asset1",
"Asset2"
]
},
"timeStamp": {
"$gt": "null"
}
},
"sort": [
{
"timeStamp": "desc"
}
]
}`
queryResults, err := getQueryResultForQueryString(stub, queryString)
if err != nil {
return shim.Error(err.Error())
}
return shim.Success(queryResults)
Here is the index :
{
"index":{
"fields":["dockType","timeStamp"]
},
"ddoc":"indexDoc",
"name":"index1Doc",
"type":"json"
}
There is the index document too in my couchdb fauxton.
But it is giving the error like :
Error: GET_QUERY_RESULT failed: transaction ID: 734c4e0c48be97ee176bb597acf7bf0cba03c0c06954200c84a78437b75afd94: error handling CouchDB request. Error:no_usable_index, Status Code:400, Reason:No index exists for this sort, try indexing by the sort fields.