一个集合中含有一个内嵌数组,我想同时利用内嵌数组外的一个数据和内嵌数组中的一个数据来查询这个集合中一个元素,如何来实现呢?求诸位能不吝赐教,谢谢了
{
"content" : "what",
"element" : "where"
"comment" : [
{
"author" : "zhangsan",
"score" : 3,
"comment" : "shafa!"
},
{
"author" : "lisi",
"score" : 5,
"comment" : "lzsb!"
}
]
}
比如说,我要把这个元素在集合中查找出来,怎么同时利用内嵌数组里面的元素和内嵌数组外面的元素进行查找呢?
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
百度啊,这篇文章说的很详细了。我也学习了一下
使用$elemMatch