Hi All,

setDescending method is not working query level


*MY VIEW*: I want to get documents with sorting lastmodified date for that i've 
wrote view here



 com.couchbase.lite.View viewTicketsPerStatusPagination = 
database.getView(String.format("%s/%s", D_DOCNAME, 
TICKETS_PER_STATUS_PAGINATION));
    viewTicketsPerStatusPagination.setMap(new Mapper() {
        @Override
        public void map(Map<String, Object> document, Emitter emitter) {

            Object type = document.get(TYPE);
            String archived = (String) document.get(ARCHIVED);

            try {
                if (type != null && DOCTYPE_TICKET.equals(type) && archived == 
null) {
                    emitter.emit(new 
Object[]{document.get(PROJECT),((HashMap<String, String>) 
document.get(DATES)).get(LASTMODIFIEDDATE)},
                            Utility.getInstance().parsingTicket(document));
                }
            } catch (NullPointerException e) {
            }
        }
    }, "3.3");
}


*My Query:*


com.couchbase.lite.View listMaps = 
AppConstants.database.getView(String.format("%s/%s", D_DOCNAME, 
TICKETS_PER_STATUS_PAGINATION));

    Query queryGetGroupNames = listMaps.createQuery().toLiveQuery();
    queryGetGroupNames.setStartKey(new Object[]{AppConstants.project_id});
    queryGetGroupNames.setEndKey(new Object[]{AppConstants.project_id, new 
HashMap<String, Object>()});

    queryGetGroupNames.setDescending(true)// this is not working
    queryGetGroupNames.setLimit(20);
    queryGetGroupNames.setSkip(0);

    QueryEnumerator result = null;
    try {
        result = queryGetGroupNames.run();
    } catch (CouchbaseLiteException ex) {
    }


    for (Iterator<QueryRow> it = result; it.hasNext(); ) {
        QueryRow row = it.next();

        Alert.getInstance().callLog("Ticket Documet information " + 
row.getValue());
    }


Note:If setDescending(false) query is giving some of result but i want to do 
like setdescending(true) but query not giving any results even not showing any 
log information.


How we can solve this problem? or any suggestions.


Thank's in advance


Thank's

Prasanna 



 

-- 
You received this message because you are subscribed to the Google Groups 
"Couchbase Mobile" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/mobile-couchbase/1708980a-a7d4-4970-9ae7-35256fe9c572%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to