-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjan-feb.js
More file actions
40 lines (35 loc) · 1.06 KB
/
jan-feb.js
File metadata and controls
40 lines (35 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
const express=require("express");
const bodyparser=require("body-parser");
const app=express();
const mongoose=require("mongoose");
mongoose.connect('mongodb://localhost:27017/Notesdiary', {useNewUrlParser: true, useUnifiedTopology: true});
let notes=[];
const article=new mongoose.Schema({
author_name: String,
month: Number,
year: Number,
date:String,
title: String,
content:String
});
let title=document.querySelector(".title");
let date=document.querySelector(".date");
let author=document.querySelector(".author");
let contents=document.querySelector(".contents");
const Article=new mongoose.model("Article",article);
Article.find({month:{$lt:03}},function (err, result) {
if(err)
{
console.error("No article to show!!");
// res.send(err);
}
else{
for(let i=0;i<result.length();i++)
{
title.innerText=result[i].title;
date.innerText=result[i].date;
author.innerText=result[i].author_name;
contents.innerText=result[i].content;
}
}
})