From 111d80e88d8e9d7dd785cc7c0afb3b74ac3df145 Mon Sep 17 00:00:00 2001 From: allegroai <> Date: Sun, 23 Aug 2020 15:39:36 +0300 Subject: [PATCH] Add migration to verify correct project ordering --- server/mongo/migrations/0.16.1.py | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 server/mongo/migrations/0.16.1.py diff --git a/server/mongo/migrations/0.16.1.py b/server/mongo/migrations/0.16.1.py new file mode 100644 index 0000000..119353a --- /dev/null +++ b/server/mongo/migrations/0.16.1.py @@ -0,0 +1,11 @@ +from pymongo.database import Database, Collection + + +def migrate_backend(db: Database): + collection: Collection = db["project"] + featured = "featured" + query = {featured: {"$exists": False}} + for doc in collection.find(filter=query, projection=()): + collection.update_one( + {"_id": doc["_id"]}, {"$set": {featured: 9999}}, + )