{ 'user_name':'xiaoming', 'books':['java','c++','php','python','js','html','android'] } 查询的时候,怎么只返回books数组中,'c++'后面的3个元素?
闭关修行中......
"The Definitive Guide to MonogDB" Second Edition 61 pages It is recommended to read more books
db.test.find({},{"books":{"$slice":[2,3]}})
"The Definitive Guide to MonogDB" Second Edition 61 pages
It is recommended to read more books