• 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 ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Rob Spoor
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Carey Brown
Bartenders:

Mongodb sorting null last for ascending order

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

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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic