mongodb 内嵌文档查询
伊谢尔伦
伊谢尔伦 2017-04-27 09:02:38
0
1
469

使用这个查询,为什么还是返回了内嵌文档所以的数据db.user.find({"_id":101,"subHobbys._id":4})

这个是返回的数据结构:
{

"_id" : NumberLong(101),
"_class" : "com.xxoo.smart.domain.entity.User",
"age" : "31",
"friendNum" : 0,
"friendMessSwitch" : 1,
"teamMessSwitch" : 1,
"headUrl" : "http://7xll7k.com2.z0.glb.qiniucdn.com/jpg/1507a114a95icon_101_2015-10-18.jpg",
"career" : "",
"mobile" : "15801607348",
"nickname" : "来乐",
"birthday" : "2015-1-1",
"horoscope" : "双子座",
"loginTime" : ISODate("2015-10-18T15:11:37.764Z"),
"sexCn" : "男",
"createTime" : ISODate("2015-10-18T02:30:44.869Z"),
"signKey" : "3843",
"signKeyTime" : ISODate("2015-10-18T02:30:44.869Z"),
"position" : {
    "x" : 116.6661600000000050,
    "y" : 40.3549369999999996
},
"easemobUserName" : "15801607348",
"easemobPassword" : "123456",
"cid" : "4eda857959a6ac32e69635575bf40244",
"teamNum" : 4,
"clientOs" : "ANDROID",
"clientOsVersion" : "1.0",
"channel" : "SportO2O",
"subHobbys" : [ 
    {
        "_id" : NumberLong(4),
        "bigHobbyId" : 1,
        "subHobbyName" : "羽毛球",
        "subHobbyId" : NumberLong(4),
        "levelType" : "中级",
        "level" : "3",
        "sign" : "http://7xll7k.com2.z0.glb.qiniucdn.com/yumaoqiu.png",
        "certFront" : "null",
        "certBack" : "null",
        "certStatus" : 0,
        "hobbyType" : 1
    }, 
    {
        "_id" : NumberLong(5),
        "bigHobbyId" : 1,
        "subHobbyName" : "乒乓",
        "subHobbyId" : NumberLong(5),
        "levelType" : "高级",
        "level" : "5",
        "sign" : "http://7xll7k.com2.z0.glb.qiniucdn.com/pingpangqiu.png",
        "certFront" : "null",
        "certBack" : "null",
        "certStatus" : 0,
        "hobbyType" : 1
    }, 
    {
        "_id" : NumberLong(16),
        "bigHobbyId" : 1,
        "subHobbyName" : "冰球",
        "subHobbyId" : NumberLong(16),
        "levelType" : "初级",
        "level" : "2",
        "sign" : "http://7xll7k.com2.z0.glb.qiniucdn.com/bingqiu.png",
        "certFront" : "null",
        "certBack" : "null",
        "certStatus" : 0,
        "hobbyType" : 2
    }, 
    {
        "_id" : NumberLong(47),
        "bigHobbyId" : 4,
        "subHobbyName" : "自行车",
        "subHobbyId" : NumberLong(47),
        "levelType" : "中级",
        "level" : "3",
        "sign" : "http://7xll7k.com2.z0.glb.qiniucdn.com/zixingche.png",
        "certFront" : "null",
        "certBack" : "null",
        "certStatus" : 0,
        "hobbyType" : 1
    }, 
    {
        "_id" : NumberLong(74),
        "bigHobbyId" : 6,
        "subHobbyName" : "运动飞机",
        "subHobbyId" : NumberLong(74),
        "levelType" : "初级",
        "level" : "1",
        "sign" : "http://7xll7k.com2.z0.glb.qiniucdn.com/yundongfeiji.png",
        "certFront" : "null",
        "certBack" : "null",
        "certStatus" : 0,
        "hobbyType" : 1
    }, 
    {
        "_id" : NumberLong(73),
        "bigHobbyId" : 6,
        "subHobbyName" : "摩托艇",
        "subHobbyId" : NumberLong(73),
        "levelType" : "初级",
        "level" : "2",
        "sign" : "http://7xll7k.com2.z0.glb.qiniucdn.com/mototing.png",
        "certFront" : "null",
        "certBack" : "null",
        "certStatus" : 0,
        "hobbyType" : 1
    }
],
"equipments" : [],
"comments" : [],
"friendIds" : [ 
    NumberLong(102)
],
"provinceName" : "北京",
"cityName" : "北京市",
"areaName" : "北京市海淀区",
"provinceId" : NumberLong(3318),
"cityId" : NumberLong(1),
"areaId" : NumberLong(7),
"teams" : [],
"teamIds" : [ 
    NumberLong(120), 
    NumberLong(119), 
    NumberLong(117)
],
"fullName" : "北京市海淀区"

}

伊谢尔伦
伊谢尔伦

小伙看你根骨奇佳,潜力无限,来学PHP伐。

모든 응답(1)
阿神

条件和文档发上来看看呢,应该是没匹配上

최신 다운로드
더>
웹 효과
웹사이트 소스 코드
웹사이트 자료
프론트엔드 템플릿
회사 소개 부인 성명 Sitemap
PHP 중국어 웹사이트:공공복지 온라인 PHP 교육,PHP 학습자의 빠른 성장을 도와주세요!