mirror of
https://github.com/Open-Dev-Society/OpenStock.git
synced 2026-05-07 05:55:51 +08:00
28 lines
801 B
JavaScript
28 lines
801 B
JavaScript
|
|
import { MongoClient } from 'mongodb';
|
|
import dotenv from 'dotenv';
|
|
dotenv.config({ path: '.env' });
|
|
|
|
async function checkSchema() {
|
|
const uri = process.env.MONGODB_URI;
|
|
if (!uri) {
|
|
console.error("No MONGODB_URI");
|
|
return;
|
|
}
|
|
const client = new MongoClient(uri);
|
|
try {
|
|
await client.connect();
|
|
const db = client.db();
|
|
const user = await db.collection('user').findOne({});
|
|
console.log("User Sample:", JSON.stringify(user, null, 2));
|
|
|
|
// Also check 'session' collection if it exists, as it might hold login activity
|
|
const session = await db.collection('session').findOne({});
|
|
console.log("Session Sample:", JSON.stringify(session, null, 2));
|
|
|
|
} finally {
|
|
await client.close();
|
|
}
|
|
}
|
|
checkSchema();
|