Last active
February 29, 2024 11:33
-
-
Save vmetnev/e4ef7fe1fe7e3321e3b9eef8b310a0d1 to your computer and use it in GitHub Desktop.
Mongoose models and schemas
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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