I've got the following entities:
var Hotel = persistence.define('Hotel', {
name: "TEXT",
numUnits: "INT",
favorite: "BOOL"
});
var Country = persistence.define('Country', {
name: "TEXT"
});
Hotel.hasOne('country', Country);
I'm trying to order a queried set of hotels by their country name, but
I can't find syntax that works:
collection.order("
hotel.country.name", false).list(null, function
(results) {...}); //produces ORDER BY `
Hotel_hotel.country.name` DESC
collection.order("
country.name", false).list(null, function (results)
{...}); //produces ORDER BY `Property_country.name` DESC
collection.order("country_name", false).list(null, function (results)
{...}); //ORDER BY `Hotel_country_name` DESC
I see that the
country.name property gets aliased in the query as
"country_name", but when I try to use that, 'Hotel_' gets prepended in
the order by clause. Is there another route I'm missing? Thanks!