omnidev / lib /mongodb.ts
fokan's picture
Initial commit
4fc8652
raw
history blame
627 Bytes
import mongoose from "mongoose";
const MONGODB_URI = process.env.MONGODB_URI;
// @ts-expect-error iknown issue with mongoose types
let cached = global.mongoose;
if (!cached) {
// @ts-expect-error iknown issue with mongoose types
cached = global.mongoose = { conn: null, promise: null };
}
// Mock database connection for local storage
// This replaces the MongoDB connection with a simple flag
let isConnected = false;
async function dbConnect() {
// Simulate connection
isConnected = true;
console.log("Using local storage instead of MongoDB Atlas");
return { isConnected: true };
}
export default dbConnect;