const db = uniCloud.database();
async function addresume() {
db.collection("resume")
.add({
"name": "12",
"birth_year": 2001,
"tel": "12377779999",
"email": "12377779999@qq.com",
"address": {
"street": "abc"
}
})
.then((res) => {
// res 为数据库查询结果
console.log(res)
}).catch((err) => {
console.log(err.message)
});
}
- 发布:2024-05-25 15:41
- 更新:2024-05-26 11:34
- 阅读:122
产品分类: uniCloud/App
示例代码:
操作步骤:
官方DB Schema概述示例中 属性列表 第一个resume例子
官方DB Schema概述示例中 属性列表 第一个resume例子
预期结果:
{
"name": "15",
"birth_year": 2001,
"tel": "12377779999",
"email": "12377779999@qq.com",
"address": {
"street": "abc"
}
}这条结果 address 下不存在 city 应该不能入库
{
"name": "15",
"birth_year": 2001,
"tel": "12377779999",
"email": "12377779999@qq.com",
"address": {
"street": "abc"
}
}这条结果 address 下不存在 city 应该不能入库
实际结果:
{
"name": "15",
"birth_year": 2001,
"tel": "12377779999",
"email": "12377779999@qq.com",
"address": {
"street": "abc"
}
}这条结果却能入库
{
"name": "15",
"birth_year": 2001,
"tel": "12377779999",
"email": "12377779999@qq.com",
"address": {
"street": "abc"
}
}这条结果却能入库
2***@qq.com (作者)
const db = uniCloud.database();
async function addresume() {
db.collection("resume").add({
"name": "12",
"birth_year": 2001,
"tel": "13677778888",
"emal": "135777789@qq.com",
"address": {
"street": "abc"
}
})
}直接在前端使用const db = uniCloud.database(); 应该走的是JQL吧
2024-05-30 10:38
2***@qq.com (作者)
resume表schema 结构是直接赋值官方文档的 addresume函数是直接在前端调用 address 下的 city字段必填 但是{
"name": "12",
"birth_year": 2001,
"tel": "13677778888",
"emal": "135777789@qq.com",
"address": {
"street": "abc"
}
})这条数据却能添加入库
2024-05-30 11:20