Explorar el Código

Sort by modification

Johannes Zellner hace 11 años
padre
commit
fcd677dcf9
Se han modificado 1 ficheros con 2 adiciones y 1 borrados
  1. 2 1
      src/routes.js

+ 2 - 1
src/routes.js

@@ -92,7 +92,7 @@ function getAll(req, res, next) {
         };
         };
     }
     }
 
 
-    g_things.find(query).sort({ createdAt: -1 }).toArray(function (error, result) {
+    g_things.find(query).sort({ modifiedAt: -1 }).toArray(function (error, result) {
         if (error || !result) return next(new HttpError(500, error));
         if (error || !result) return next(new HttpError(500, error));
 
 
         async.each(result, function (thing, callback) {
         async.each(result, function (thing, callback) {
@@ -125,6 +125,7 @@ function add(req, res, next) {
     var doc = {
     var doc = {
         content: data,
         content: data,
         createdAt: new Date(),
         createdAt: new Date(),
+        modifiedAt: new Date(),
         tags: tags
         tags: tags
     };
     };