Skip to content

Instantly share code, notes, and snippets.

View ftmoose's full-sized avatar

Mostapha ftmoose

View GitHub Profile
@ftmoose
ftmoose / docker-compose.yml
Last active February 17, 2024 10:30
MongoDB ReplicaSet Docker Configuration
version: "3.1"
# Our containers
services:
# Temporary container used to initialize the replica set
mongo-setup:
container_name: mongo-setup
image: mongo
restart: on-failure
networks:
const postSchema = new Schema({
type: { type: String, enum: ['blurb', 'image', 'video'] },
blurb: { type: String, required: true },
media: String,
user: {
id: { type: ObjectId, ref: 'user', required: true },
username: String,
picture: String
},
created: { type: Date }
const userSchema = new Schema({
username: String,
picture: { type: String, default: "https://domain.com/some-pic.png" },
googleId: String,
facebookId: String
});
userSchema.index({ username: 1 });
userSchema.index({ googleId: 1 });
userSchema.index({ facebookId: 1 });