只显示文档中所有的特定字段

本文介绍了一个具体的日程事件查询示例,展示了如何通过数据库查询获取指定的日程信息,包括事件的主题、日期、时间等详细属性。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

{
    "_id": {
        "$id": "515bb7e2a00b2add0b000001"
    },
    "user_id": "user_8888",
    "events": {
        "common test I": {
            "subject": "common test I",
            "start_date": "04/14/2013",
            "start_time": "8.00 AM",
            "end_date": "04/14/2013",
            "end_time": "10.30 AM",
            "all_day_event": "false",
            "discription": "no discription",
            "location": "STC",
            "private": "false",
            "time_zone": "IST",
            "alarm": "true",
            "alarm_threshold": "5",
            "status": "true"
        }
    }
}

只要
 {
            "subject": "common test I",
            "start_date": "04/14/2013",
            "start_time": "8.00 AM",
            "end_date": "04/14/2013",
            "end_time": "10.30 AM",
            "all_day_event": "false",
            "discription": "no discription",
            "location": "STC",
            "private": "false",
            "time_zone": "IST",
            "alarm": "true",
            "alarm_threshold": "5",
            "status": "true"
        }

db.collection.find({},{"events.common test I":1,_id:0})

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值