Support reverse sort for redis
This commit is contained in:
parent
639820bf29
commit
c33bc70756
|
@ -203,6 +203,7 @@ BridgeToRedis.prototype.all = function all(model, filter, callback) {
|
|||
orders = [filter.order];
|
||||
}
|
||||
orders.forEach(function (key) {
|
||||
key = key.split(' ')[0];
|
||||
if (props[key].type.name !== 'Number' && props[key].type.name !== 'Date') {
|
||||
allNumeric = false;
|
||||
}
|
||||
|
@ -246,7 +247,7 @@ BridgeToRedis.prototype.all = function all(model, filter, callback) {
|
|||
orders.forEach(function (key) {
|
||||
var m = key.match(/\s+(A|DE)SC$/i);
|
||||
if (m) {
|
||||
key = key.replace(/\s+DESC/i, '');
|
||||
key = key.replace(/\s+(A|DE)SC/i, '');
|
||||
if (m[1] === 'DE') reverse = true;
|
||||
}
|
||||
if (key !== 'id') {
|
||||
|
|
|
@ -52,8 +52,8 @@ function testOrm(schema) {
|
|||
it('should define class', function (test) {
|
||||
|
||||
User = schema.define('User', {
|
||||
name: String,
|
||||
email: String,
|
||||
name: { type: String, index: true },
|
||||
email: { type: String, index: true },
|
||||
bio: Text,
|
||||
approved: Boolean,
|
||||
joinedAt: Date,
|
||||
|
|
Loading…
Reference in New Issue