File tree 2 files changed +10
-2
lines changed
2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -188,7 +188,15 @@ Query.prototype.toConstructor = function toConstructor() {
188
188
189
189
p . options = { } ;
190
190
191
- p . setOptions ( this . options ) ;
191
+ // Need to handle `sort()` separately because entries-style `sort()` syntax
192
+ // `sort([['prop1', 1]])` confuses mquery into losing the outer nested array.
193
+ // See gh-8159
194
+ const options = Object . assign ( { } , this . options ) ;
195
+ if ( options . sort != null ) {
196
+ p . sort ( options . sort ) ;
197
+ delete options . sort ;
198
+ }
199
+ p . setOptions ( options ) ;
192
200
193
201
p . op = this . op ;
194
202
p . _conditions = utils . clone ( this . _conditions ) ;
Original file line number Diff line number Diff line change 25
25
"mongodb" : " 3.3.2" ,
26
26
"mongoose-legacy-pluralize" : " 1.0.2" ,
27
27
"mpath" : " 0.6.0" ,
28
- "mquery" : " 3.2.1 " ,
28
+ "mquery" : " 3.2.2 " ,
29
29
"ms" : " 2.1.2" ,
30
30
"regexp-clone" : " 1.0.0" ,
31
31
"safe-buffer" : " 5.1.2" ,
You can’t perform that action at this time.
0 commit comments