voot look likes

PHOTO EMBED

Mon Jan 29 2024 05:22:42 GMT+0000 (Coordinated Universal Time)

Saved by @praveenmacha777

const mongoose = require('mongoose');

const voteSchema = new mongoose.Schema({
  poll: { type: mongoose.Schema.Types.ObjectId, ref: 'Poll' },
  option: { type: mongoose.Schema.Types.ObjectId, ref: 'Option' },
  voter: { type: mongoose.Schema.Types.ObjectId, ref: 'Voter' },
  createdAt: { type: Date, default: Date.now }
});

module.exports = mongoose.model('Vote', voteSchema);
content_copyCOPY

This code assumes that you have a Vote model defined in a file called models/vote.js. Here is an example of what the Vote model might look like: