Click here to Skip to main content
15,881,866 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am trying to sort capped collection in descending order.

what I have tried:

    @Query(sort = "{$natural:-1}")
    Flux<Message> findAllByConversationId(String conversationId);

it gives:

Query failed with error code 2 and error message cannot use tailable option with a sort other than {$natural: 1}'

but when I use this query in robo3t:

db.getCollection('message').find({}).sort({$natural:-1})
it works fine !

any help ?

What I have tried:

<pre>what I have tried:

    @Query(sort = "{$natural:-1}")
    Flux<Message> findAllByConversationId(String conversationId);

it gives:

Query failed with error code 2 and error message cannot use tailable option with a sort other than {$natural: 1}'

but when I use this query in robo3t:

db.getCollection('message').find({}).sort({$natural:-1})
it works fine !
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900