当前位置:网站首页>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;
边栏推荐
- Solve the problem that the database configuration information under the ThinkPHP framework application directory is still connected by default after modification
- After 95, Alibaba P7 published the payroll: it's really fragrant to make up this
- Is it safe for Guosen Securities to open an account online?
- 淺淺的談一下ThreadLocalInsecureRandom
- Where is the operation of new bonds? Is it safer and more reliable to open an account
- SecureRandom那些事|真伪随机数
- 【数字IC验证快速入门】6、Questasim 快速上手使用(以全加器设计与验证为例)
- A way to calculate LNX
- 浅浅的谈一下ThreadLocalInsecureRandom
- 港股将迎“最牛十元店“,名创优品能借IPO突围?
猜你喜欢

Leetcode skimming: binary tree 17 (construct binary tree from middle order and post order traversal sequence)

Securerandom things | true and false random numbers

死信队列入门(两个消费者,一个生产者)

How to select the Block Editor? Impression notes verse, notation, flowus

JS implementation prohibits web page zooming (ctrl+ mouse, +, - zooming effective pro test)

Zero cloud new UI design

基础篇——配置文件解析

JVMRandom不可设置种子|问题追溯|源码追溯

Rainbond 5.7.1 支持对接多家公有云和集群异常报警

港股将迎“最牛十元店“,名创优品能借IPO突围?
随机推荐
Debezium series: modify the source code to support drop foreign key if exists FK
实操演示:产研团队如何高效构建需求工作流?
Scala basics [HelloWorld code parsing, variables and identifiers]
leetcode刷题:二叉树10(完全二叉树的节点个数)
leetcode刷题:二叉树15(找树左下角的值)
走入并行的世界
When JS method passes long type ID value, precision loss will occur
点云文件的.dat文件读取保存
图嵌入Graph embedding学习笔记
Autumn byte interviewer asked you any questions? In fact, you have stepped on thunder
[quick start of Digital IC Verification] 9. Finite state machine (FSM) necessary for Verilog RTL design
随机数生成的四种方法|Random|Math|ThreadLocalRandom|SecurityRandom
2022年7月4日-2022年7月10日(ue4视频教程mysql)
USACO3.4 “破锣摇滚”乐队 Raucous Rockers - DP
基础篇——配置文件解析
中金财富在网上开户安全吗?
1: Citation;
JVMRandom不可设置种子|问题追溯|源码追溯
Wechat applet regular expression extraction link
mongodb/文档操作