Explorar el Código

Pop last version, not last timestamp

James Allen hace 12 años
padre
commit
866084ee6b

+ 1 - 1
services/track-changes/app/coffee/MongoManager.coffee

@@ -5,7 +5,7 @@ module.exports = MongoManager =
 	getLastCompressedUpdate: (doc_id, callback = (error, update) ->) ->
 		db.docHistory
 			.find(doc_id: ObjectId(doc_id.toString()))
-			.sort( "meta.end_ts": -1)
+			.sort( v: -1 )
 			.limit(1)
 			.toArray (error, compressedUpdates) ->
 				return callback(error) if error?

+ 2 - 2
services/track-changes/test/unit/coffee/MongoManager/MongoManagerTests.coffee

@@ -34,9 +34,9 @@ describe "MongoManager", ->
 				.calledWith(1)
 				.should.equal true
 
-		it "should sort in descending timestamp order", ->
+		it "should sort in descending version order", ->
 			@db.docHistory.sort
-				.calledWith("meta.end_ts": -1)
+				.calledWith(v: -1)
 				.should.equal true
 
 		it "should call the call back with the update", ->