From 7f6a88e88ff4f20bbad2349e4fcb60da589f835e Mon Sep 17 00:00:00 2001 From: Matthew Evans <7916000+ml-evs@users.noreply.github.com> Date: Tue, 23 Jan 2024 14:52:54 +0000 Subject: [PATCH] Sort entries alphabetically (#72) * Sort entries alphabetically * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- marda_registry/app.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/marda_registry/app.py b/marda_registry/app.py index 050de9e..3465e40 100644 --- a/marda_registry/app.py +++ b/marda_registry/app.py @@ -83,6 +83,7 @@ def get_filetypes(): }, # Remove the temporary `extractors` field {"$project": {"_id": 0, "extractors": 0}}, + {"$sort": {"id": 1}}, ] ) ), @@ -129,7 +130,15 @@ def search_file_types(query: str): @api.get("/extractors", response_model=ExtractorEntryResponse) def get_extractors(): return { - "data": list(db.extractors.find({}, projection={"_id": 0})), + "data": list( + db.extractors.find( + {}, + projection={"_id": 0}, + sort=[ + ("id", 1), + ], + ) + ), "meta": _get_info(), }