From f8a76de50be575a0befa47a7e7aa2b337417f271 Mon Sep 17 00:00:00 2001 From: Erik Moeller Date: Thu, 9 Jul 2015 16:51:41 -0700 Subject: [PATCH] Fix sort specification for newer versions of MongoDB. As of >=2.6 MongoDB does not accept "1" as a valid specification and throws an error: Can't canonicalize query: BadValue bad sort specification See: http://docs.mongodb.org/manual/release-notes/2.6-compatibility/#sort-specification-values --- problems/my_first_query/solution.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/problems/my_first_query/solution.js b/problems/my_first_query/solution.js index 708b9d3..824ed6d 100644 --- a/problems/my_first_query/solution.js +++ b/problems/my_first_query/solution.js @@ -9,7 +9,7 @@ MongoClient.connect('mongodb://127.0.0.1:27017/learnmymongodb', function(err, db var collection = db .collection('test') .find({}) - .sort({'value': '1'}) + .sort({'value': 1}) .toArray(function(err, object) { if (err) console.warn(err.message); console.dir(object);