不要怂,就是干,撸起袖子干!

Commit c87f4ea1 by Nick Matenaar

Update querying documentation

`order` supports both ordering by an instance's associate's fields as well as any nested associate's fields. `order` also supports aliased associates too. This update adds an example of this functionality to the documentation, so that users are both aware of and how to use this feature.
1 parent 2ec7baac
Showing with 9 additions and 0 deletions
......@@ -254,6 +254,15 @@ something.findOne({
// Will order by otherfunction(`col1`, 12, 'lalala') DESC
[sequelize.fn('otherfunction', sequelize.col('col1'), 12, 'lalala'), 'DESC'],
// Will order by name on an associated User
[User, 'name', 'DESC'],
// Will order by name on an associated User aliased as Friend
[{model: User, as: 'Friend'}, 'name', 'DESC'],
// Will order by name on a nested associated Company of an associated User
[User, Company, 'name', 'DESC'],
]
// All the following statements will be treated literally so should be treated with care
order: 'convert(user_name using gbk)'
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!