Home > Database > Mysql Tutorial > body text

MongoDB 学习笔记二

WBOY
Release: 2016-06-07 16:31:14
Original
1096 people have browsed it

#save和insert方法类似,都是插入数据,但是save当主键相同的时候会自动更新db.c1.save({_id: 1, name:'user7'});#删除name为user1的数据db.c1.remove({name:'user1'});#批量插入数据for(i=1; i20; i++) { db.c1.insert({name:'user'+i, age:i }) }#查询结构

#save和insert方法类似,都是插入数据,但是save当主键相同的时候会自动更新
db.c1.save({_id: 1, name:'user7'});
#删除name为user1的数据
db.c1.remove({name:'user1'});
#批量插入数据
for(i=1; i
    <p class="copyright">
        原文地址:MongoDB 学习笔记二, 感谢原作者分享。
    </p>
    
    


Copy after login
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template