Sindbad~EG File Manager

Current Path : /home/infinitibizsol/.trash/migrations.8/
Upload File :
Current File : /home/infinitibizsol/.trash/migrations.8/convert-primary-email-to-email.js

/* const mongoose = require("mongoose");
const db = require("../model/index");
console.log(process.env.DB_URL);
console.log(db.default.TestUser);
// Define the connection string
const 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();
  }
}); */
"use strict";

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists