Skip to content

Date column sorting issue with 'sortable' option #230

@gokuzhan

Description

@gokuzhan

Hi there,

I don't see what's wrong with this simple query.

Schema

import { Schema } from 'redis-om';

export type User = {
  id: string;
  gender: string;
  age: number;
  lastMatchAt: Date;
};

export const userSchema = new Schema(
  'User',
  {
    id: { type: 'string' },
    gender: { type: 'string' },
    age: { type: 'number' },
    lastMatchAt: { type: 'date', sortable: true },
  },
  { dataStructure: 'HASH', indexName: 'id' },
);

Query

    const find = this.db.userRepository.search().where('id').is.not.equalTo(me.id);

    if ([Gender.Male, Gender.Female].includes(looking.gender)) {
        find.and('gender').is.equalTo(looking.gender);
    }
    
    find.and('age').is.between(looking.minAge, looking.maxAge);
    
    return await find.returnMin('lastMatchAt');   

Result

[ErrorReply: Property lastMatchAt not loaded nor in schema]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions