Skip to content

Date column sorting issue with 'sortable' option #230

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
gokuzhan opened this issue Feb 10, 2024 · 2 comments
Open

Date column sorting issue with 'sortable' option #230

gokuzhan opened this issue Feb 10, 2024 · 2 comments

Comments

@gokuzhan
Copy link

gokuzhan commented Feb 10, 2024

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]

@MR4online
Copy link

MR4online commented Apr 8, 2024

I had the same error minutes ago.
Restarting the nodeJs-Service / Docker-Container fixed it for me.
May there an issue like: indexing on service start took too long, so that redis-om thinks it's not there?

[EDIT: still happens almost everytime I start my services. @guyroyse may you please have a look?]

@Desnoo
Copy link

Desnoo commented May 21, 2024

The issue at our end (@MR4online, same company) was, that the index was overwritten by another service at startup. That in the end some fields were missing on the used index.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants