![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
MongoDB初学
Swen.
此人很写,什么都没有懒~
展开
-
MongoDB--基础操作 增删改查
一、插入文档db.stus.insert({name:"猪八戒",age:28,gender:"男"})db.stus.insert([ {name:"猪八戒",age:28,gender:"男"} {name:"孙悟空",age:18,gender:"男"} {name:"唐僧",age:24,gender:"男"} {name:"白骨精",age:22,ge...原创 2019-08-05 20:17:18 · 196 阅读 · 0 评论 -
MongoDB--查询内嵌,循环,push添加
查询内嵌,循环,push添加db.users.update( {username:"swk"},{$set: {hobby: {cities:["beijing","shanghai"],movies:["sanguo","hero"]}} })查询内嵌文档可通过.的形式来匹配,注意加引号db.users.find({"hobby.movies":...原创 2019-08-08 11:32:36 · 703 阅读 · 0 评论 -
MongoDB--文档一对多,多对多,多对一关系
文档间的关系一、One to One例:夫妻db.WifeAndHusband.insert([ { name:"黄蓉",husband:{name:"郭靖"} }, { name:"潘金莲",husband:{name:"武大郎"} },])db.WifeAndHusband.find()二、One to Many...原创 2019-08-06 11:56:20 · 4149 阅读 · 6 评论