// MongoDB initialization script for BCards // Create BCards database db = db.getSiblingDB('bcards'); // Create collections db.createCollection('users'); db.createCollection('cards'); db.createCollection('sessions'); // Create indexes db.users.createIndex({ "email": 1 }, { unique: true }); db.cards.createIndex({ "userId": 1 }); db.cards.createIndex({ "createdAt": 1 }); db.sessions.createIndex({ "createdAt": 1 }, { expireAfterSeconds: 3600 }); // Insert sample data for testing db.users.insertMany([ { _id: ObjectId(), email: "test1@bcards.site", name: "Test User 1", createdAt: new Date() }, { _id: ObjectId(), email: "test2@bcards.site", name: "Test User 2", createdAt: new Date() } ]); db.cards.insertMany([ { _id: ObjectId(), userId: db.users.findOne({"email": "test1@bcards.site"})._id, title: "Test Card 1", content: "This is a test card for infrastructure testing", tags: ["test", "infrastructure"], createdAt: new Date() }, { _id: ObjectId(), userId: db.users.findOne({"email": "test2@bcards.site"})._id, title: "Test Card 2", content: "Another test card for load balancer testing", tags: ["test", "load-balancer"], createdAt: new Date() } ]); print("BCards database initialized successfully!");