Mongod --dbpath e:data2(新建的自定义路径)
show dbs
use + 数据库
db.表名.insert({"":""})
show collections
db.当前集合名.find()
for(var i=0;i<10;i++){
db.数据库名.insert({"name":"stu"+i,"age":"10+i"})
}
(lt(小于),gt(大于),gte(大于等于),lte(小于等于))
找到年龄大于15的数据
db.集合名.find({'age':{$gte:15}})
db.集合名.remove(条件)
db.集合名.find({$or:[{字符:值},{字符:值}]})
db.集合名.find({"age":{$gt:15,$lt:18}})
db.集合名.update({"name":"stu"},{$set:{key:value}})
db.集合名.find().sort({age:-1}) -1表示降序
db.集合名.find().sort({age:1}) 1表示升序
db.集合名.drop()
1、什么是加密?
crypto 模块提供了加密功能,包括对 OpenSSL 的哈希、HMAC、加密、解密、签名、以及验证功能的一整套封装。
2、如何实现?
const crypto = require('crypto')
const secret = 'abcdefg';
const hash = crypto.createHmac('sha256', secret)
.update('I love cupcakes')
.digest('hex');
console.log(hash);
打印:c0fa1bc00531bd78ef38c628449c5102aeabd49b5dc3a2a516ea6ea959d6658e
原文:https://www.cnblogs.com/cc0419/p/12110967.html