Skip to content

Commit

Permalink
11
Browse files Browse the repository at this point in the history
  • Loading branch information
rasin-lau committed Jun 14, 2019
1 parent f8f7d01 commit c3d213b
Show file tree
Hide file tree
Showing 506 changed files with 123,014 additions and 61 deletions.
65 changes: 4 additions & 61 deletions 07.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ req.body.后端要求的字段

koa2

码云: svn和git
码云: svn和git

svn 代码管理仓库
两区:
Expand All @@ -48,72 +48,15 @@ git bash here

git init 项目初始化 .git
git status 状态
git add 文件名(big.txt) 添加文件
git add 文件名(big.txt) 添加文件 git add . 所有
git commit -m "注释" 提交
登录
git --config user.name "用户名"
git --config user.password "密码"
git remote add origin 仓库地址 链接远程仓库
git push -u origin master 推送到远端 -u origin master(仅针对于第一次提交)
g it push -u origin master 推送到远端 -u origin master(仅针对于第一次提交)
git push
cmd
vim

github 仓库







git = github

名称 :代码管理工具

项目:

负责 : 毕永学 诚意春

两台设备:代码 QQ 微信 u盘

index.js


var a=1


var a=2



冲突==》代码管理工具 =》 svn 鼠标操作即可 本地区 服务区 冲突 index var a

checkout 检出

commit 提交

pull 拉取

缺点:

本地区 服务区 本地=》线上

git

本地区 暂存区 服务区

git==》github

码云=》svn 和 git









github 仓库
98 changes: 98 additions & 0 deletions 08.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
mongodb

数据库:
关系型数据库
mysql 数据库 表
orancel DBA
非关系型数据库
[
{
"name":"4545"
}
]

mongodb nosql sqlserver
mongodb: 文档 集合
面向文档(document)
{
"name":"333"
}
show dbs 查看当前的所有数据库
use admin 使用数据库
show collections 查看当前数据库下面的集合
db 查看当前选中的数据库
db.集合名.insert({}) 创建集合
insert
db.集合名.insert({}) 插入单条
db.集合名.insert([{},{}]) 插入多条
db.集合名.insertOne({}) 插入单条
db.集合名.insertMany([]) 插入多条
remove
db.集合名.remove({}) 删除所有
db.集合名.remove({"name":"tom"}) 删除指定的数据
delete
db.集合名.deleteOne() 删除单个
db.集合名.deleteMany() 删除多个
update 修改
{"name":"tom","age":12}
db.集合名.update({"name":"tom"},{$set:{"name":"jack"}}) 更新
db.集合名.update({"name":"tom"},{"name":"jack"})
{"name":"jack"}
find
db.集合名.findOne() 查询单个数据
pretty() 数据格式化
limit() 截取 长度 几条
skip () 跳过当前数据 数字 从第几条开始
创建集合
两种
db.createCollection("集合名",options)
db.student.insert()
删除当前数据库
db.dropDatabase()
删除集合
db.集合名.drop()

<div class="pagation">
<ul>
<li>1</li>
<li>2</li>
<li>3</li>
<li>4</li>
<li>5</li>
</ul>
</div>
$.ajax({
url:"http://127.0.0.1:3000/list",
type:"get",
dataType:"json",
settimeout:3000,
data:{
pageSize: //页数
pageNum: //每页显示的条数
}
}).done(function(result){
<!-- result count 总数 7 -->
var pageSize=Math.ceil(count/pageNum)
循环
$(".pageation").html("<li click="aa(i)"></li>")
})

条件语句
$gt 大于 $gte $lt 小于 $lte $ne 不等于 $and 并且 $or 或者
排序:
sort() 1 正序 -1 倒序
作业:
插入文件
mongoimport --db 数据库名称 --collection 集合名称 --file 文件路径

数据类型
聚合






1 change: 1 addition & 0 deletions day07/05.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@ app.listen(3000)
// express-session
// git
// mongodb

35 changes: 35 additions & 0 deletions day08/01.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
var express=require("express")
// mongodb
// 引入mongodb的客户端
var mongoClient=require("mongodb").MongoClient
var app=express()
app.get("/add",(req,res)=>{
// 客户端连接服务端
mongoClient.connect("mongodb://127.0.0.1:27017",(err,db)=>{
// 连接数据库
var dbName=db.db("test")
// 查找
// dbName.collection("data").find({"name":"tom"}).toArray((err,data)=>{
// res.send(data)
// })
// 针对集合操作 插入
// dbName.collection("data").insert({"name":"jack"},(err,data)=>{
// // console.log(data)
// res.send(data)
// })
//更新
// dbName.collection("data").update({"name":"jack"},
// {$set:{"name":"jacks"}},(err,data)=>{
// res.send(data)
// })
// 删除
dbName.collection("data").deleteOne({"name":"jacks"},(err,data)=>{
if(err){
throw err
}
res.send({"success":"删除成功"})
})
})

})
app.listen(3000)
43 changes: 43 additions & 0 deletions day08/02.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
// 登录 注册
var express=require("express")
var router=express.Router()
var bodyparser=require("body-parser")
var app=express()
app.use(bodyparser.json())
app.use(bodyparser.urlencoded({extended:false}))
app.use(router)
var mongoClient=require("mongodb").MongoClient
// 注册
router.post("/register",(req,res)=>{
mongoClient.connect("mongodb://127.0.0.1:27017",(err,db)=>{
var dbName=db.db("store")
var data={
username:req.body.username,
password:req.body.password,
email:req.body.email,
phone:req.body.phone,
}
dbName.collection("course").insert(data,(err,data)=>{
res.send({"success":"注册成功"})
})
})
})
// 登录
router.post("/login",(req,res)=>{
mongoClient.connect("mongodb://127.0.0.1:27017",(err,db)=>{
var dbName=db.db("store")
var person={
username:req.body.username,
password:req.body.password
}
dbName.collection("course").find({}).toArray((err,data)=>{
if(err) throw err
if(person.username==data[0].username&&person.password==data[0].password){
res.send({"success":"登陆成功"})
}else{
res.send({"fail":"登录失败"})
}
})
})
})
app.listen(3000)
18 changes: 18 additions & 0 deletions day08/form.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
<form action="http://127.0.0.1:3000/register" method="post">
用户名<input type="text" name="username"/>
密码<input type="text" name="password"/>
邮箱<input type="text" name="email"/>
手机<input type="text" name="phone"/>
<input type="submit" value="提交"/>
</form>
</body>
</html>
16 changes: 16 additions & 0 deletions day08/login.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
<form action="http://127.0.0.1:3000/login" method="post">
用户名<input type="text" name="username"/>
密码<input type="text" name="password"/>
<input type="submit" value="登陆"/>
</form>
</body>
</html>
15 changes: 15 additions & 0 deletions day08/node_modules/.bin/mime

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions day08/node_modules/.bin/mime.cmd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions day08/node_modules/.bin/semver

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions day08/node_modules/.bin/semver.cmd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit c3d213b

Please sign in to comment.