0

I use System.Linq.Dynamic to order a MongoDB collection.

mongoCollection.AsQueryable().OrderBy("Name ASC");

But the lowercase names gets ordered after the capital cased names, so the items are returned something like this.

  • Ape
  • Cat
  • Dog
  • alligator
  • ant
  • beetle

I rather expected this:

  • alligator
  • ant
  • Ape
  • beetle
  • Cat
  • Dog

Is there a way to get the correct order?

Adrian Rosca
  • 6,922
  • 9
  • 40
  • 57

1 Answers1

0

Have you tried

mongoCollection.AsQueryable().ToList().OrderBy(c=>c.Name.ToLower());
COLD TOLD
  • 13,513
  • 3
  • 35
  • 52