没有合适的资源?快使用搜索试试~ 我知道了~
MongoDB查询练习题及答案
需积分: 46 4 下载量 173 浏览量
2022-07-29
17:30:39
上传
评论
收藏 34KB DOCX 举报
温馨提示
试读
34页
NoSQL数据库之MongoDB查询
资源详情
资源评论
资源推荐
mongodb 查询练习
db.users.drop()
;
var user1 = {
"name" : "xiaobu",
"country" : "china",
"comments" :
[
{
"userId" : "001",
"content" : "评论 1",
"commentTime" : "2018-04-22 22:50:48.39"
},
{
"userId" : "002",
"content" : "评论 2",
"commentTime" : "2018-04-22 22:51:48.39"
},
{
"userId" : "003",
"content" : "评论 3",
"commentTime" : "2018-04-22 22:52:48.39"
},
{
"userId" : "004",
"content" : "评论 4",
"commentTime" : "2018-04-22 22:53:48.39"
},
{
"userId" : "005",
"content" : "评论 5",
"commentTime" : "2018-04-22 22:54:48.39"
},
{
"userId" : "006",
"content" : "评论 6",
"commentTime" : "2018-04-22 22:55:48.39"
},
{
"userId" : "007",
"content" : "评论 7",
"commentTime" : "2018-04-22 22:56:48.39"
},
{
"userId" : "008",
"content" : "评论 8",
"commentTime" : "2018-04-22 22:57:48.39"
},
{
"userId" : "009",
"content" : "评论 9",
"commentTime" : "2018-04-22 22:58:48.39"
}
],
"address" : {
"aCode" : "001",
"aName" : "长沙"
},
"favorites" : {
"books" : [
"西游记",
"红楼梦",
"三国演义",
"水浒传"
],
"cites" : [
"韶关",
"深圳",
"佛山"
],
"fruits" : [
"apple",
"banana",
"watermelon"
]
},
"age" : 26.0,
"salary" : NumberDecimal("18889.09"),
"height" : 1.7
}
;
var user2 = {
"name" : "juyi",
"country" : "china",
"comments" : [
{
"userId" : "101",
"content" : "评论 101",
"commentTime" : "2018-04-22 22:50:48.39"
},
{
"userId" : "102",
"content" : "评论 102",
"commentTime" : "2018-04-22 22:51:48.39"
}
],
"address" : {
"aCode" : "002",
"aName" : "韶关"
},
"favorites" : {
"movies" : [
"肖生克的救赎",
"阿甘正传",
"头号玩家"
],
"cites" : [
"衡阳",
"南宁",
"上海",
"深圳"
],
"fruits" : [
"durian",
"watermelon"
]
},
"age" : 25.0,
"salary" : NumberDecimal("18889.09"),
"height" : 1.5
}
;
var user3 = {
"name" : "tom",
"country" : "USA",
"comments":{
"$ref" : "comments",
"$id" : ObjectId("5ae20a927aec117179c68468"),
"$db" : "test"
},
"address" : {
剩余33页未读,继续阅读
weixin_41557534
- 粉丝: 0
- 资源: 3
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论0