簡體   English   中英

Mongoose 排序時字段名稱包含空格?

[英]Mongoose sort when field name contains whitespace?

我正在嘗試按名稱中帶有空格的字段進行排序,解決方法是什么?

詢問:

this.query = this.query.sort("Review Score");

Model:

["Review Score"]: {
  type: String,
},

對於上升:

this.query = this.query.sort({ "Review Score": 1 });

對於下降:

this.query = this.query.sort({ "Review Score": -1 });

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM