Skip to content

Commit

Permalink
add mongoose models
Browse files Browse the repository at this point in the history
  • Loading branch information
AdithyakrishnaV committed Jul 1, 2021
1 parent a8e9eff commit 40e788e
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 0 deletions.
13 changes: 13 additions & 0 deletions author.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
const mongoose = require("mongoose");

//Creating an author schema
const AuthorSchema = mongoose.Schema({
id: Number,
name: String,
books:[String]
});

// Creating a model
const AuthorModel = mongoose.model(AuthorSchema);

module.exports = AuthorModel;
18 changes: 18 additions & 0 deletions book.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
const mongoose = require("mongoose");

//Creating a book schema
const BookSchema = mongoose.Schema({
ISBN: String,
title: String,
pubDate: String,
language: String,
numPage: Number,
authors: [Number],
publication: [Number],
category: [String],
});

// Create a model
const BookModel = mongoose.model(BookSchema);

module.exports = BookModel;
13 changes: 13 additions & 0 deletions publication.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
const mongoose = require("mongoose");

// Publication schema
const PublicationSchema = mongoose.Schema({
id: Number,
name: String,
books:[String]
});

// Creating a model
const PublicationModel = mongoose.model(PublicationSchema);

module.exports = PublicationModel;

0 comments on commit 40e788e

Please sign in to comment.