当前位置:网站首页>Document method
Document method
2022-07-05 20:16:00 【Why not sell egg cakes well】
18 Document Method
var stu=new StuModel({
name:" Rush to bully ",
age:48,
gender:"male"
});
console.log(stu);
stu.save(function (err){
if(!err){
console.log(" Saved successfully ");
}
});
StuModel.findOne({
},function (err,doc){
doc.update({
$set:{
age:27}},function (err){
if(!err){
console.log(" Modification successful ";)
}
})
});
StuModel.findOne({
},function (err,doc){
doc.age=18;
doc.save();
});
Delete
StuModel.findOne({
},function (err,doc){
doc.remove(function (err){
if(!err){
console.log(" Goodbye, elder martial brother ");
}
})
});
obtain
doc.get("age");
// Or more succinct
doc.age;
Set the specified attribute value of the document
doc.set("name","xai");
Database is not affected ,
doc.name="hhh";
Get document underline id
doc.id
toJson/toObject
Turn into json object , Pay attention to all document Object methods cannot be used
var j=doc.toJson();
Turn to object
doc=doc.toObject();
delete doc.address;
边栏推荐
- Bzoj 3747 poi2015 kinoman segment tree
- Is it safe for Guosen Securities to open an account online?
- Leetcode(347)——前 K 个高频元素
- How to select the Block Editor? Impression notes verse, notation, flowus
- Flume series: interceptor filtering data
- 95后阿里P7晒出工资单:狠补了这个,真香...
- 强化学习-学习笔记4 | Actor-Critic
- 2023年深圳市绿色低碳产业扶持计划申报指南
- Oracle tablespace management
- Leetcode brush question: binary tree 13 (the same tree)
猜你喜欢
Wechat applet regular expression extraction link
Leetcode skimming: binary tree 10 (number of nodes of a complete binary tree)
.Net分布式事務及落地解决方案
B站UP搭建世界首个纯红石神经网络、基于深度学习动作识别的色情检测、陈天奇《机器学编译MLC》课程进展、AI前沿论文 | ShowMeAI资讯日报 #07.05
Zero cloud new UI design
leetcode刷题:二叉树14(左叶子之和)
零道云新UI设计中
走入并行的世界
计算lnx的一种方式
Leetcode brush question: binary tree 13 (the same tree)
随机推荐
Ffplay document [easy to understand]
MySql的root密码忘记该怎么找回
How to choose a good external disk platform, safe and formal?
sun.misc.BASE64Encoder报错解决方法[通俗易懂]
- Oui. Net Distributed Transaction and Landing Solution
[quick start of Digital IC Verification] 1. Talk about Digital IC Verification, understand the contents of the column, and clarify the learning objectives
Leetcode skimming: binary tree 10 (number of nodes of a complete binary tree)
Station B up builds the world's first pure red stone neural network, pornographic detection based on deep learning action recognition, Chen Tianqi's course progress of machine science compilation MLC,
Leetcode skimming: binary tree 16 (path sum)
期货如何网上开户?安不安全?
[quick start of Digital IC Verification] 9. Finite state machine (FSM) necessary for Verilog RTL design
.Net分布式事务及落地解决方案
信息学奥赛一本通 1339:【例3-4】求后序遍历 | 洛谷 P1827 [USACO3.4] 美国血统 American Heritage
港股将迎“最牛十元店“,名创优品能借IPO突围?
Practical demonstration: how can the production research team efficiently build the requirements workflow?
Go language | 02 for loop and the use of common functions
Go language | 01 wsl+vscode environment construction pit avoidance Guide
Go language learning tutorial (16)
2023年深圳市绿色低碳产业扶持计划申报指南
Convolution free backbone network: Pyramid transformer to improve the accuracy of target detection / segmentation and other tasks (with source code)