Schema and Model in Mongoose (2 of 2)

So the point of Schema is to define what properties can be read. The point of model is instead to define what collection is read. Try const uri = process.env.DB_URL; const port = process.env.PORT || 3000; const localTest = "mongodb://127.0.0.1:27017/test" const express = require("express") const mongoose = require("mongoose") const app = express() app.use(express.static("public")) main().catch((err) => console.log(err)) async function main() { await mongoose.connect(localTest) } // There is no "goingCrazy" property in Kitten // There is instead a "name" property of the type String.

READ MORE

Self-cultivation for Web Full-Stack Engineers (2015): a review

Free Chinese language excerpts released by the author here. A point which really caught my eye was the author’s reaction to the Non-Designer’s Design Book by Robin Williams. In fact, this is how the author caught the eye of his interviewer for his first employer, Tencent, 我说这些作品都是我先在白纸上手绘——主要是彩色铅笔——然后用照相机拍下来,放到ps里处理一下对比度什么的,就作为一个设计了,然后还有自己喜欢的专辑里的一些元素,然后还考虑了色彩,还有一些信息的对齐之类的, 其实我的设计知识仅限于看的一本书《写给大家看的设计书》。这本书非常棒,到现在为止我都反复看了3遍以上,因为约书亚树原理说的是,当你对一个概念的名字很熟悉的时候,当你看到这个概念,就会马上意识到,而不是无意识的一晃而过。然后我就提到了书里说的设计的四大原则:对齐、对比、距离和重复,面试官表示很有兴趣。 (Rough translation: I first hand-drawed these works on white paper - mainly colored pencils - and then photographed them with a camera, put them in Photoshop to process the contrast and so on, and then used them as a design, and then included my favorite albums…

READ MORE

Migrating to Hugo

What eventually gave me the push to migrate to Hugo from Jekyll was not technical superiority; but difficulty of getting support online. I wanted to remove the “Subscribe via RSS” line at the footer of my Jekyll webpage. But the only information I could find about this was this discussion from 2019. Too many things have changed since then and the solution doesn’t work easily (or possibly at all). Contrast Hugo: the only difficulty I ran into was when I was deploying on Github pages (via Action), and I forgot to include the “workflows” folder within the “.

READ MORE

You cannot name a MongoDB collection "hello"

(A draft StackOverlow questioned that I answered for myself) Draft question I am using mongosh version 2.26 on iTerm2 (Build 3.5.0) on a Mac. I am starting to explore MongoDB with the aim of setting up a MERN website. When I run mongosh, the Mongo shell correctly opens. Within the Mongo shell, I switch to and create a new db, e.g. one called random, by > use random. $ show collections correctly shows no collection.

READ MORE

Doc-as-Code in theory and practice

In this Write-the-Docs London talk on 2 May 2024, speakers shared their experiences with using software tools to automate the publication of their companies’ documentation. Because these software tools are also used by programmers for computer code, this approach is also known as “Doc-as-Code”. Vladimir Izmalkov gave the first presentation. He gave a broad overview of common software tools for Doc-as-Code, including (amongst others):- Git for version control Markdown for formatting text Hugo for deploying a static website Vladimir then shared VK Private Cloud’s experience with migrating documentation from Confluence to Git in a short time frame, and in the process changing the underlying document format from Microsoft Word to AsciiDoc.

READ MORE