使用这个查询,为什么还是返回了内嵌文档所以的数据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" : "北京市海淀区"
}
J'ai envoyé les conditions et documents pour vérifier, ils ne correspondent probablement pas