hongzhongfang opened a new issue #612: the sort do not work when I use $regex , $ne or $not any one in selector URL: https://github.com/apache/couchdb/issues/612 <!--- Provide a general summary of the issue in the Title above --> I have a requiremtn is to search for some content using a selector, then to sort the results according to the specified field examples: docs: _id Name Debut Series dk Donkey Kong 1981 Mario falcon Captain Falcon 1990 F-Zero fox Fox 1993 Star Fox kirby Kirby 1992 Kirby link Link 1986 Zelda luigi Luigi 1983 Mario mario Mario 1981 Mario ness Ness 1994 Earthbound pikachu Pikachu 1996 Pokemon puff Jigglypuff 1996 Pokemon samus Samus 1986 Metroid yoshi Yoshi 1990 Mario code1: work correctly, the results sorted by name desc ``` db.createIndex({ index: {fields: ['name']} }).then(function)(){ return db.find({ selector:{name:{$gt:null}}, sort:[{name:'desc'}] }) } ``` code2: do not work ``` db.createIndex({ index: {fields: ['name']} }).then(function)(){ return db.find({ selector:{name:{$ne:"xx"}}, sort:[{name:'desc'}] }) } ``` I read the pouchdb and couchdb's documents, knows that: once we have an index on a field, we can sort documents by this field but $regex, $ne and $not cannot use on-disk indexes, and must use in-memory filtering instead. so this means we can't use the sort when we use $regex, $ne or $not in selector, ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected]
With regards, Apache Git Services
