couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Randall Leeds (JIRA)" <j...@apache.org>
Subject [jira] Commented: (COUCHDB-927) Problem with item list starting with startkey (result in broken paginating)
Date Wed, 27 Oct 2010 10:45:20 GMT

    [ https://issues.apache.org/jira/browse/COUCHDB-927?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12925321#action_12925321
] 

Randall Leeds commented on COUCHDB-927:
---------------------------------------

I think you are mistaken.
The sort order you see is correct and startkey is incorrectly specified for your query.

The keys of your view output are strings and sort as such. If you would like them to sort
numerical they must be converted to a numeric type.

If instead the sort order is what you wanted by startkey doesn't seem to work it is because
startkey is also interpreted as JSON. You should specify a string as the start key by placing
it in quotes (url encoded would make it %221238573%22, or similar).

In your example output only the first result has a numeric key and it sorts after your startkey.
The rest of the keys are strings and therefore sort by prefix and all of them after the numeric
key.

If I am mistaken please clarify your problem.

> Problem with item list starting with startkey (result in broken paginating)
> ---------------------------------------------------------------------------
>
>                 Key: COUCHDB-927
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-927
>             Project: CouchDB
>          Issue Type: Bug
>    Affects Versions: 0.11
>            Reporter: Yurgen Ude
>
> Problem with item list starting with  startkey like:
> /_design/user/_view/by_msisdn?limit=21&startkey=1234987650
> for view:
> function(doc) {
> 	if (doc.type == 'user' && doc.status != 'DELETED') {
> 		emit(doc.msisdn, doc.username);
> 	}
> }
> returns wrong data (expected started item goes on 20th place; key "1234987650" is unique):
> {"total_rows":313,"offset":176,"rows":[
> {"id":"06382895fa04ebc1618bbf262723e264","key":2222244444.0,"value":"222224"},
> {"id":"05c9f0b2e72d0fd6ecc0723cef7edcc6","key":"0011223344","value":"0011223344@example.com"},
> {"id":"7aecd68c97189e19834f0f2686db22f1","key":"0123498765","value":null},
> {"id":"51be2572858a1dbb030afe81de3f57cc","key":"0561278349","value":null},
> {"id":"13af15d83d9bc51d27c5850086d08262","key":"1","value":null},
> {"id":"35157fdf1dd0b7d63e0f73d7667b04d4","key":"1010101010","value":null},
> {"id":"bbcf936f323981a6b0e31b8548825ae4","key":"1111111111","value":null},
> {"id":"06382895fa04ebc1618bbf262745b6b0","key":"111222","value":"1@test.com"},
> {"id":"06382895fa04ebc1618bbf26273ae339","key":"115599","value":"115599"},
> {"id":"06382895fa04ebc1618bbf26273afd2d","key":"115599","value":"115599"},
> {"id":"06382895fa04ebc1618bbf262737707b","key":"123123","value":"123123"},
> {"id":"5c1381758c7312744e151616e8713bc9","key":"12321","value":null},
> {"id":"a5335d12ded0cafa8c79d57e5f7a3fc4","key":"1233333333","value":null},
> {"id":"c69915beeddfd7da574e9664e8cbe4a3","key":"1234321234","value":null},
> {"id":"451b103e577d917bd7898c1635aea383","key":"1234444444","value":null},
> {"id":"06382895fa04ebc1618bbf262724a848","key":"123456789","value":"1243583343"},
> {"id":"84ca288485191c0cc91086a44eda284d","key":"1234567894","value":null},
> {"id":"b2f531889f23bf9be83fa96578d5cbe4","key":"1234777777","value":null},
> {"id":"c29945eae127f3edb797bb641810433b","key":"1234987605","value":null},
> {"id":"b3032d33041f9c8eb8a726f2defa1321","key":"1234987650","value":null},
> {"id":"ed3f4e78c624edcabca52d70219b1959","key":"1234987656","value":null}
> ]}
>  

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message