Add migration to verify correct project ordering

This commit is contained in:
allegroai 2020-08-23 15:39:36 +03:00
parent 6718862dbe
commit 111d80e88d

View File

@ -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}},
)