JSORM the isomorphic, framework-agnostic Javascript ORM

Sorting

Use #order() to sort.

If passed a string, it will default to ascending:

Post.order("title").all()

/posts?sort=title

Otherwise, pass an object:

Post.order({ title: "desc" }).all()

/posts?sort=-title

For multisort, simply chain multiple #order() clauses:

Post
  .order({ title: "desc" })
  .order("ranking")
  .all()

/posts?sort=-title,ranking