Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
希望创建一个可以先按州然后按城市排序的业务目录(类似于 Craigslist)。
我应该分别创建州模型和城市模型,还是创建一个将州和城市作为位置表中单独列的位置模型?
我会选择 2 列:state和city.
state
city
为了去像:
Collection.order('state ASC')或者 Collection.order('city ASC')
Collection.order('state ASC')
Collection.order('city ASC')
之后取决于你想要的东西有多复杂。