suchen

Heim  >  Fragen und Antworten  >  Hauptteil

mongodb数组子集查询


'user_name':'xiaoming',
'books':['java','c++','php','python','js','html','android']

查询的时候,怎么只返回books数组中,'c++'后面的3个元素?

阿神阿神2845 Tage vor656

Antworte allen(2)Ich werde antworten

  • 迷茫

    迷茫2017-04-24 09:15:23

    《MonogDB权威指南》第二版 61页
    建议多翻书

    Antwort
    0
  • 迷茫

    迷茫2017-04-24 09:15:23

    db.test.find({},{"books":{"$slice":[2,3]}})

    Antwort
    0
  • StornierenAntwort