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
41
42
43
44
45
46
47
48
49
50
51
52
53
|
"use strict";
// mongosh --host 127.0.0.1 --port 27117 -u mongo -p mongo -f put_in_db.js
const fs = require("fs");
const path = require("path");
// db = connect("http://mongo:mongo@127.0.0.1:27117");
blogs = [
{
title: "Turning C structs into Lua tables",
slug: "c_struct_lua_table",
body: fs.readFileSync(path.join(__dirname) + "/mds/cstruct2luatable.md"),
teaser: "Turning C structures into Lua tables",
keywords: "c,lua",
lastUpdatedAt: Date.now(),
},
{
title: "Lazy Makefiles",
slug: "lazy_makefile",
body: fs.readFileSync(path.join(__dirname) + "/mds/lazymakefiles.md"),
teaser: "Lazy Makefiles",
keywords: "makefile,c,c++",
lastUpdatedAt: Date.now(),
},
{
title: "One Chat Client For Everything",
slug: "one_chat_client_for_everything",
body: fs.readFileSync(
path.join(__dirname) + "/mds/oneclientforeverything.md",
),
teaser: "One Chat Client For Everything",
keywords: "irc,matrix,mattermost,matterbridge,bitlbee,irssi",
lastUpdatedAt: Date.now(),
},
{
title: "How to Get your SMS on IRC",
slug: "how_to_get_your_sms_on_irc",
body: fs.readFileSync(
path.join(__dirname) + "/mds/howtogetyourSMSonIRC.md",
),
teaser: "How to Get your SMS on IRC",
keywords: "irc,bot,sms",
lastUpdatedAt: Date.now(),
},
];
// db.blogposts.insertMany(blogs);
db.blogposts.updateMany(
{ $set: blogs },
{
upsert: true,
},
);
|