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.
並べ替えで変数を使用するには? これは機能していません。
var order = "name"; var dir = "desc"; Board.sort({order : dir}).exec(function(err, results) { });
変数の値をキーとして使用するには、括弧を使用する必要があります[]
[]
Board.sort({[order] : dir}).exec(function(err, results) { }); <----- Using [] on order variable