?
目錄
說(shuō)明:?
被稱為全球領(lǐng)先的阿里云
mangoDB ??????
阿里云與mongoDB
刪除數(shù)據(jù)(批量)
刪除之前
后端(阿里云端,云函數(shù):one111)
?前端(客戶端)vue
刪除之后
?修改數(shù)據(jù)(批量)
修改之前
?后端(阿里云端,云函數(shù):one111)
?前端(客戶端)vue
修改之后
?增加數(shù)據(jù)(指定數(shù)據(jù))
添加前
??后端(阿里云端,云函數(shù):one111)
?前端(客戶端)vue
添加后
增加數(shù)據(jù)(用戶可添加數(shù)據(jù)到數(shù)據(jù)庫(kù))
添加前
后端(阿里云端,云函數(shù):one111)
前端(客戶端)vue
?添加后?
?查尋數(shù)據(jù)(渲染到前端頁(yè)面)
后端(阿里云端,云函數(shù):one111)
前端(客戶端)vue
效果顯示
?文章來(lái)源地址http://www.zghlxwxcb.cn/news/detail-791120.html
?說(shuō)明:?
隨著騰訊云的服務(wù)的收費(fèi)規(guī)則的改變,我們(學(xué)生黨)再用騰訊云開發(fā)時(shí),是我們本不富裕的日子,雪上加霜。而我們可以發(fā)現(xiàn),阿里云當(dāng)前還是一個(gè)處于免費(fèi)的狀態(tài)!
?被稱為全球領(lǐng)先的阿里云
????????阿里云創(chuàng)立于2009年,是全球領(lǐng)先的云計(jì)算及人工智能科技公司,致力于以在線公共服務(wù)的方式,提供安全、可靠的計(jì)算和數(shù)據(jù)處理能力,讓計(jì)算和人工智能成為普惠科技。阿里云服務(wù)著制造、金融、政務(wù)、交通、醫(yī)療、電信、能源等眾多領(lǐng)域的領(lǐng)軍企業(yè),包括中國(guó)聯(lián)通、12306、中石化、中石油、飛利浦、華大基因等大型企業(yè)客戶,以及微博、知乎、錘子科技等明星互聯(lián)網(wǎng)公司。在天貓雙11全球狂歡節(jié)、12306春運(yùn)購(gòu)票等極富挑戰(zhàn)的應(yīng)用場(chǎng)景中,阿里云保持著良好的運(yùn)行紀(jì)錄 。
????????阿里云在全球各地部署高效節(jié)能的綠色數(shù)據(jù)中心,利用清潔計(jì)算為萬(wàn)物互聯(lián)的新世界提供源源不斷的能源動(dòng)力,開服的區(qū)域包括中國(guó)(華北、華東、華南、香港)、新加坡、美國(guó)(美東、美西)、歐洲、中東、澳大利亞、日本。
????????2014年,阿里云曾幫助用戶抵御全球互聯(lián)網(wǎng)史上最大的DDoS攻擊,峰值流量達(dá)到每秒453.8Gb? 。在Sort Benchmark 2016 排序競(jìng)賽 CloudSort項(xiàng)目中,阿里云以1.44$/TB的排序花費(fèi)打破了AWS保持的4.51$/TB紀(jì)錄?? 。在Sort Benchmark 2015,阿里云利用自研的分布式計(jì)算平臺(tái)ODPS,377秒完成100TB數(shù)據(jù)排序,刷新了Apache Spark 1406秒的世界紀(jì)錄?? 。
????????2019年3月3日凌晨,阿里云深夜出現(xiàn)故障,阿里云官方回復(fù),華北2地域可用區(qū)C部分ECS服務(wù)器等實(shí)例出現(xiàn)IO HANG 持續(xù)了三個(gè)小時(shí)左右, 經(jīng)緊急排查處理后逐步恢復(fù)。2019年6月11日,阿里云入選“2019福布斯中國(guó)最具創(chuàng)新力企業(yè)榜”。
mangoDB ??????
??????? MongoDB是由c++編寫的一個(gè)基于分布式文件存儲(chǔ) [1]? 的數(shù)據(jù)庫(kù)。由C++語(yǔ)言編寫。旨在為WEB應(yīng)用提供可擴(kuò)展的高性能數(shù)據(jù)存儲(chǔ)解決方案。
????????MongoDB是一個(gè)介于關(guān)系數(shù)據(jù)庫(kù)和非關(guān)系數(shù)據(jù)庫(kù)之間的產(chǎn)品,是非關(guān)系數(shù)據(jù)庫(kù)當(dāng)中功能最豐富,最像關(guān)系數(shù)據(jù)庫(kù)的。它支持的數(shù)據(jù)結(jié)構(gòu)非常松散,是類似json的bson格式,因此可以存儲(chǔ)比較復(fù)雜的數(shù)據(jù)類型。Mongo最大的特點(diǎn)是它支持的查詢語(yǔ)言非常強(qiáng)大,其語(yǔ)法有點(diǎn)類似于面向?qū)ο蟮牟樵冋Z(yǔ)言,幾乎可以實(shí)現(xiàn)類似關(guān)系數(shù)據(jù)庫(kù)單表查詢的絕大部分功能,而且還支持對(duì)數(shù)據(jù)建立索引。
?
阿里云與mongoDB
?
阿里云數(shù)據(jù)庫(kù)MongoDB版在部署架構(gòu)的靈活性以及服務(wù)可用性、數(shù)據(jù)可靠性、安全性、運(yùn)維成本等方面具有突出的優(yōu)勢(shì)。
?
????????產(chǎn)品研發(fā)方面,雙方技術(shù)團(tuán)隊(duì)定期溝通,共同為阿里云上的MongoDB輸出更多產(chǎn)品特性,如在MongoDB 4.4版本中,Hidden Index 就是阿里云和 MongoDB 官方共建的一個(gè)重大特性。雙方攜手為全球客戶打造一流的云數(shù)據(jù)庫(kù)產(chǎn)品能力。
????????客戶支持方面,MongoDB在中國(guó)專門設(shè)置了CPM(Cloud Partner Manager)團(tuán)隊(duì),與阿里云在客戶支持上展開專項(xiàng)合作,已為吉比特、廣州餐道等數(shù)十家客戶提供培訓(xùn)賦能或?qū)I(yè)支持服務(wù),讓企業(yè)用戶可以將更多精力聚焦業(yè)務(wù)的創(chuàng)新上。
????????生態(tài)建設(shè)方面,阿里云數(shù)據(jù)庫(kù)團(tuán)隊(duì)多名成員在MongoDB中文社區(qū)擔(dān)任核心角色,參與官方技術(shù)文檔翻譯、分享技術(shù)博客,組織參與各城市站MongoDB技術(shù)沙龍和年度峰會(huì),分享阿里云MongoDB技術(shù)創(chuàng)新和最佳實(shí)踐議題。
????????據(jù)悉,2020年、2021年,阿里云分別榮獲MongoDB頒發(fā)的“年度最佳ISV伙伴獎(jiǎng)”及“年度MongoDB最佳合作伙伴獎(jiǎng)”,今年再次獲頒“年度新興市場(chǎng)最佳云合作伙伴獎(jiǎng)”,這是對(duì)阿里云在亞太地區(qū)對(duì)MongoDB貢獻(xiàn)的高度認(rèn)可。
????????阿里云自主研發(fā)了PolarDB、AnalyticDB、Lindorm等云原生數(shù)據(jù)庫(kù)產(chǎn)品,并作為中國(guó)唯一的科技廠商連續(xù)兩年成功進(jìn)入Gartner全球數(shù)據(jù)庫(kù)領(lǐng)導(dǎo)者象限。目前已服務(wù)政務(wù)、零售、金融、電信、制造、物流等多個(gè)領(lǐng)域的龍頭企業(yè)。
?
刪除數(shù)據(jù)(批量)
刪除之前
后端(阿里云端,云函數(shù):one111)
index.js
'use strict';
const db = uniCloud.database()
exports.main = async (event, context) => {
let res = await db.collection('users').where({
age:'20'
}).remove()
return {
msg:'刪除成功!',
res
};
};
?前端(客戶端)vue
index.vue
<template>
<view class="flex">
<!-- <view v-for="item in usersALL" :key="item._id">
<view>姓名:{{item.name}}</view>
<view>年齡:{{item.age}}</view>
</view> -->
<button @click="shanchu">批量刪除的數(shù)據(jù)記錄</button>
</view>
</template>
<script>
export default {
data() {
return {
title: 'Hello',
// usersALL:[]
}
},
onLoad() {
// uniCloud.callFunction({
// name:'one111',
// data:{}
// }).then(res=>{
// console.log(res)
// this.usersALL=res.result.data
// })
},
methods: {
shanchu(){
uniCloud.callFunction({
name:'one111',
}).then(res=>{
console.log(res)
})
}
},
}
</script>
<style>
.flex{
display: flex;
flex-direction:row;
justify-content: space-around;
}
.zhanshi{
background: pink;
width: 100%;
height: 500px;
}
.flex{
display: flex;
flex-direction: row;
justify-content: space-around;
align-items: center;
}
.content {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.logo {
height: 200rpx;
width: 200rpx;
margin-top: 200rpx;
margin-left: auto;
margin-right: auto;
margin-bottom: 50rpx;
}
.text-area {
display: flex;
justify-content: center;
}
.title {
font-size: 36rpx;
color: #8f8f94;
}
</style>
刪除之后
?修改數(shù)據(jù)(批量)
修改之前
?后端(阿里云端,云函數(shù):one111)
index.js
'use strict';
const db = uniCloud.database()
exports.main = async (event, context) => {
let res = await db.collection('users').where({
age:'20'
}).update({
keaidu:'100%'
})
return {
msg:'修改成功!',
res
};
};
?前端(客戶端)vue
index.vue
<template>
<view class="flex">
<!-- <view v-for="item in usersALL" :key="item._id">
<view>姓名:{{item.name}}</view>
<view>年齡:{{item.age}}</view>
</view> -->
<button @click="shanchu">批量修改的數(shù)據(jù)記錄</button>
</view>
</template>
<script>
export default {
data() {
return {
title: 'Hello',
// usersALL:[]
}
},
onLoad() {
// uniCloud.callFunction({
// name:'one111',
// data:{}
// }).then(res=>{
// console.log(res)
// this.usersALL=res.result.data
// })
},
methods: {
shanchu(){
uniCloud.callFunction({
name:'one111',
}).then(res=>{
console.log(res)
})
}
},
}
</script>
<style>
.flex{
display: flex;
flex-direction:row;
justify-content: space-around;
}
.zhanshi{
background: pink;
width: 100%;
height: 500px;
}
.flex{
display: flex;
flex-direction: row;
justify-content: space-around;
align-items: center;
}
.content {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.logo {
height: 200rpx;
width: 200rpx;
margin-top: 200rpx;
margin-left: auto;
margin-right: auto;
margin-bottom: 50rpx;
}
.text-area {
display: flex;
justify-content: center;
}
.title {
font-size: 36rpx;
color: #8f8f94;
}
</style>
修改之后
keaidu都變成了100%
?增加數(shù)據(jù)(指定數(shù)據(jù))
添加前
??后端(阿里云端,云函數(shù):one111)
index.js
'use strict';
const db = uniCloud.database()
exports.main = async (event, context) => {
let res = await db.collection('users').add({
name:'小崽崽',
age:'1',
keaidu:'100%'
})
return {
msg:'添加成功!',
res
};
};
?前端(客戶端)vue
index.vue
<template>
<view class="flex">
<!-- <view v-for="item in usersALL" :key="item._id">
<view>姓名:{{item.name}}</view>
<view>年齡:{{item.age}}</view>
</view> -->
<button @click="shanchu">添加的數(shù)據(jù)記錄</button>
</view>
</template>
<script>
export default {
data() {
return {
title: 'Hello',
// usersALL:[]
}
},
onLoad() {
// uniCloud.callFunction({
// name:'one111',
// data:{}
// }).then(res=>{
// console.log(res)
// this.usersALL=res.result.data
// })
},
methods: {
shanchu(){
uniCloud.callFunction({
name:'one111',
}).then(res=>{
console.log(res)
})
}
},
}
</script>
<style>
.flex{
display: flex;
flex-direction:row;
justify-content: space-around;
}
.zhanshi{
background: pink;
width: 100%;
height: 500px;
}
.flex{
display: flex;
flex-direction: row;
justify-content: space-around;
align-items: center;
}
.content {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.logo {
height: 200rpx;
width: 200rpx;
margin-top: 200rpx;
margin-left: auto;
margin-right: auto;
margin-bottom: 50rpx;
}
.text-area {
display: flex;
justify-content: center;
}
.title {
font-size: 36rpx;
color: #8f8f94;
}
</style>
添加后
增加數(shù)據(jù)(用戶可添加數(shù)據(jù)到數(shù)據(jù)庫(kù))
添加前
后端(阿里云端,云函數(shù):one111)
index.js
'use strict';
const db = uniCloud.database()
exports.main = async (event, context) => {
let {name,age} = event;
let res = await db.collection('users').add({
name,
age
}
)
return {
res
};
};
前端(客戶端)vue
index.vue
<template>
<view class="flex">
<form @submit="onsubmit">
<input type="text" name="name"/>
<input type="text" name="age"/>
<button form-type="submit">添加</button>
</form>
</view>
</template>
<script>
export default {
data() {
return {
title: 'Hello',
usersALL:[]
}
},
onLoad() {
// uniCloud.callFunction({
// name:'one111',
// data:{}
// }).then(res=>{
// console.log(res)
// this.usersALL=res.result.res.data
// })
},
methods: {
onsubmit(e){
console.log(e)
let obj = e.detail.value;
uniCloud.callFunction({
name:"one111",
data:obj
}).then(res=>{
console.log(res)
})
}
},
}
</script>
<style>
.flex{
display: flex;
flex-direction:row;
justify-content: space-around;
}
.zhanshi{
background: pink;
width: 100%;
height: 500px;
}
.flex{
display: flex;
flex-direction: row;
justify-content: space-around;
align-items: center;
}
.content {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.logo {
height: 200rpx;
width: 200rpx;
margin-top: 200rpx;
margin-left: auto;
margin-right: auto;
margin-bottom: 50rpx;
}
.text-area {
display: flex;
justify-content: center;
}
.title {
font-size: 36rpx;
color: #8f8f94;
}
</style>
?添加后?
?
?查尋數(shù)據(jù)(渲染到前端頁(yè)面)
?數(shù)據(jù)庫(kù)中一共由四條數(shù)據(jù),我們把他們的值都查詢出來(lái)并渲染在前端頁(yè)面顯示!
后端(阿里云端,云函數(shù):one111)
index.js
'use strict';
const db = uniCloud.database()
exports.main = async (event, context) => {
let res = await db.collection('users').get()
return {
res
};
};
前端(客戶端)vue
index.vue
<template>
<view >
<view v-for="item in usersALL" :key="item._id">
<view>姓名:{{item.name}}</view>
<view>年齡:{{item.age}}</view>
</view>
<!-- <button @click="shanchu">添加的數(shù)據(jù)記錄</button> -->
</view>
</template>
<script>
export default {
data() {
return {
title: 'Hello',
usersALL:[]
}
},
onLoad() {
uniCloud.callFunction({
name:'one111',
data:{}
}).then(res=>{
console.log(res)
this.usersALL=res.result.res.data
})
},
methods: {
// shanchu(){
// uniCloud.callFunction({
// name:'one111',
// }).then(res=>{
// console.log(res)
// })
// }
},
}
</script>
<style>
.flex{
display: flex;
flex-direction:row;
justify-content: space-around;
}
.zhanshi{
background: pink;
width: 100%;
height: 500px;
}
.flex{
display: flex;
flex-direction: row;
justify-content: space-around;
align-items: center;
}
.content {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.logo {
height: 200rpx;
width: 200rpx;
margin-top: 200rpx;
margin-left: auto;
margin-right: auto;
margin-bottom: 50rpx;
}
.text-area {
display: flex;
justify-content: center;
}
.title {
font-size: 36rpx;
color: #8f8f94;
}
</style>
效果顯示
文章來(lái)源:http://www.zghlxwxcb.cn/news/detail-791120.html
?
到了這里,關(guān)于Vue+阿里云(繼承mongoDB數(shù)據(jù)庫(kù))的增刪改查的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!