Skip to content

Instantly share code, notes, and snippets.

@vmetnev
Last active February 29, 2024 11:33
Show Gist options
  • Save vmetnev/e4ef7fe1fe7e3321e3b9eef8b310a0d1 to your computer and use it in GitHub Desktop.
Save vmetnev/e4ef7fe1fe7e3321e3b9eef8b310a0d1 to your computer and use it in GitHub Desktop.
Mongoose models and schemas
const mongoose = require("mongoose");
const {
Schema
} = mongoose;
const TickerSchema =
new Schema({
ticker: String,
date: String,
data: Schema.Types.Mixed,
})
module.exports = TickerSchema
const mongoose = require("mongoose");
const Schema = mongoose.Schema;
// models with individual collection name from set schema
const TickerModel = mongoose.model('tickerdata2024-02-28', require('../Models/TickerSchema'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment