Skip to content

Commit

Permalink
feat: migration (#1721)
Browse files Browse the repository at this point in the history
  • Loading branch information
alanlr authored Dec 18, 2024
1 parent 82531bb commit b2480d2
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { logger } from "@/common/logger"
import { getDbCollection } from "@/common/utils/mongodbUtils"

export const up = async () => {
logger.info("20241218-fix-recruiter-missing-geopoint started")
for await (const { _id, geo_coordinates } of getDbCollection("recruiters").find({ geopoint: null, geo_coordinates: { $ne: null } })) {
const [latitude, longitude] = geo_coordinates!.split(",").map((coord) => parseFloat(coord))
await getDbCollection("recruiters").updateOne({ _id }, { $set: { geopoint: { type: "Point", coordinates: [longitude, latitude] } } })
}
logger.info("20241218-fix-recruiter-missing-geopoint ended")
}

0 comments on commit b2480d2

Please sign in to comment.