How to use Mongoose's sort() function in cosmos DB?

디엔소프트 DNSOFT 196 Reputation points

const user = await User.find({ level: 'user' }).sort({ class: 'asc' }).select({ password: 0 })

errmsg:'Error=2, Details=\'Response status code does not indicate success: BadRequest (400); Substatus: 0; ActivityId: f9fb7d60-da8b-4697-b77b-7a83218014e8; Reason: (Message: {"Errors":["The index path corresponding to the specified order-by item is excluded."]}\r\nActivityId: f9fb7d60-da8b-4697-b77b-7a83218014e8, Request URI: /apps/ a977c348-dbcb-43ee-8b19-4bb37642d953/services/c8407aa2-c5f4-4218-9966-268d2677b66f/partitions/006a36db-fe6b-476c-9950-0878ff6c5fe3/replicas/132464217036121510s/, RequestStats: Please see CosmosDiagnostics, SDK: Windows/10.0 .14393 cosmos-netstandard-sdk/3.3.2);',
code: 2,
I got this error

Azure Cosmos DB
Azure Cosmos DB
An Azure NoSQL database service for app development.
1,365 questions
{count} votes

1 answer

Sort by: Most helpful
  1. 디엔소프트 DNSOFT 196 Reputation points

    I solved it. I misunderstood it, I thought the values ​​in the column would be sorted, thank you

    0 comments No comments