• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
  • Mikalai Zaikin

Mongodb sorting null last for ascending order

Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

I am facing one issue while using the mongodb sorting. By default sorting takes place on null values as first elements for ascending order and last elements in descending order. For one of my requirement i have to display all null values at last place irrespective of the sorting order.

If it is single column, it should be fine. But i have to sort on multiple fields at a time. And for all the fields it has to take consider all null values as last values.

Is there any way that mongodb supports for this. I am using spring data. Thought spring sort provides the feature of Null Last as the parameter, some how it is not working.

It is very urgent for me. I really appreciate if any one help me on this.
Consider Paul's rocket mass heater.
    Bookmark Topic Watch Topic
  • New Topic