Created
April 21, 2021 20:43
-
-
Save smpnjn/d58ecf16562a01c8c6ab7a2f8e404e32 to your computer and use it in GitHub Desktop.
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
import mongoose from 'mongoose' | |
const database = 'mongodb://localhost:27017/articles'; | |
const connection = mongoose.createConnection(database, { | |
useNewUrlParser: true, | |
useUnifiedTopology: true, | |
useFindAndModify: false | |
}); | |
const schema = new mongoose.Schema({ | |
title: 'String', | |
description: 'String', | |
articleText: 'String', | |
date: 'Number' | |
}); | |
const Article = connection.model('Article', schema); | |
export { Article }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment