/
home
/
infinitibizsol
/
.trash
/
migrations.3
/
File Upload :
llllll
Current File: /home/infinitibizsol/.trash/migrations.3/convert-primary-email-to-email.js
"use strict"; var mongoose = require("mongoose"); var db = require("../model/index"); console.log(process.env.DB_URL); console.log(db["default"].TestUser); // Define the connection string var mongoURI = "mongodb+srv://awais:a59n7VAiBtQ5uf4g@cluster0.1fcwe.mongodb.net/?retryWrites=true&w=majority&appName=Cluster0"; // Replace with your actual MongoDB connection string /* // Connect to MongoDB mongoose.connect(mongoURI, { useNewUrlParser: true, useUnifiedTopology: true }); const db = mongoose.connection; db.on("error", console.error.bind(console, "connection error:")); db.once("open", async () => { console.log("Connected to MongoDB"); try { // Define your User schema and model if not already defined elsewhere // Perform the update operation await User.updateMany({}, { $rename: { primary_email: "email" } }); console.log("Field renamed successfully"); } catch (err) { console.error("Error during migration:", err); } finally { // Close the connection db.close(); } }); */
Copyright ©2k19 -
Hexid
|
Tex7ure