09 2020 档案
摘要:session 原理 session会话机制是⼀种服务器端机制,它使⽤类似于哈希表(可能还有哈希表)的结构来保存信息。 实现原理: 服务器在接受客户端⾸次访问时在服务器端创建seesion,然后保存seesion(我们可以将seesion保存在内存中,也可以保存在redis中,推荐使⽤后者),然后给
阅读全文
摘要:cookie 原理 Header Set-Cookie负责设置cookie 请求传递Cookie const express = require('express') const app = express() app.get('/', function(req, res) { const cook
阅读全文
摘要:元素 操作符 $exists 匹配具有指定字段的文档 // mongodb 数据 [ {price: 1, name: 'xx 1', message: 'message 1'}, {price: 2, name: 'xx 2', message: null}, {name: 'xx 3', mes
阅读全文
摘要:逻辑操作符 $and 并且 用逻辑联接查询子句and返回与两个子句条件都匹配的所有文档。 col.find({$and: [{ price: { $eq: 1 } },{ category: { $eq: '水果' } }] }) // 返回 price 1 并且 category '水果' 的数据
阅读全文
摘要:操作符 eq匹配等于指定的值col.find(price:$eq:1)//[price:1]gt 匹配大于指定的值 col.find({price: {gt: 2}}) // [{price: 3}, {price: 4}, {price: 5}]gte 匹配大
阅读全文