@GetMapping(value="/test5") public R test5(){ List<MongoTest> mongoTests = Arrays.asList(new MongoTest("1a", 54, "tom", "4"), new MongoTest("4a", 24, "tom", "4"), new MongoTest("3a", 33, "tom", "4"), new MongoTest("22", 98, "tom", "4"), new MongoTest("5", 11, "tom", "4")); mongoTests.sort(Comparator.comparing(MongoTest::getId)); return R.ok().put("data", mongoTests); }