<bdo id='GIIUp'></bdo><ul id='GIIUp'></ul>
      1. <tfoot id='GIIUp'></tfoot>

        <legend id='GIIUp'><style id='GIIUp'><dir id='GIIUp'><q id='GIIUp'></q></dir></style></legend>
      2. <i id='GIIUp'><tr id='GIIUp'><dt id='GIIUp'><q id='GIIUp'><span id='GIIUp'><b id='GIIUp'><form id='GIIUp'><ins id='GIIUp'></ins><ul id='GIIUp'></ul><sub id='GIIUp'></sub></form><legend id='GIIUp'></legend><bdo id='GIIUp'><pre id='GIIUp'><center id='GIIUp'></center></pre></bdo></b><th id='GIIUp'></th></span></q></dt></tr></i><div id='GIIUp'><tfoot id='GIIUp'></tfoot><dl id='GIIUp'><fieldset id='GIIUp'></fieldset></dl></div>

        <small id='GIIUp'></small><noframes id='GIIUp'>

        如何在mongodb中找到数组的最后一项?

        How to find into mongodb to the last item of an array?(如何在mongodb中找到数组的最后一项?)
        <tfoot id='S6Oub'></tfoot>
          <bdo id='S6Oub'></bdo><ul id='S6Oub'></ul>
              <tbody id='S6Oub'></tbody>

              <i id='S6Oub'><tr id='S6Oub'><dt id='S6Oub'><q id='S6Oub'><span id='S6Oub'><b id='S6Oub'><form id='S6Oub'><ins id='S6Oub'></ins><ul id='S6Oub'></ul><sub id='S6Oub'></sub></form><legend id='S6Oub'></legend><bdo id='S6Oub'><pre id='S6Oub'><center id='S6Oub'></center></pre></bdo></b><th id='S6Oub'></th></span></q></dt></tr></i><div id='S6Oub'><tfoot id='S6Oub'></tfoot><dl id='S6Oub'><fieldset id='S6Oub'></fieldset></dl></div>

                <small id='S6Oub'></small><noframes id='S6Oub'>

                <legend id='S6Oub'><style id='S6Oub'><dir id='S6Oub'><q id='S6Oub'></q></dir></style></legend>

                1. 本文介绍了如何在mongodb中找到数组的最后一项?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我想查找数组中最后一个元素等于某个值的文档.可以通过特定的数组位置访问数组元素:

                  I want to find documents where last elements in an array equals to some value. Array elements may be accessed by specific array position:

                  // i.e. comments[0].by == "Abe"
                  db.example.find( { "comments.0.by" : "Abe" } )
                  

                  但是我如何使用最后一项作为条件进行搜索?即

                  but how do i search using the last item as criteria? i.e.

                  db.example.find( { "comments.last.by" : "Abe" } )
                  

                  顺便说一下,我正在使用 php

                  By the way, i'm using php

                  推荐答案

                  我只是在做:

                  db.products.find({'statusHistory.status':'AVAILABLE'},{'statusHistory': {$slice: -1}})
                  

                  这让我获得 products,其中数组中最后一个 statusHistory 项包含属性 status='AVAILABLE' .

                  This gets me products for which the last statusHistory item in the array, contains the property status='AVAILABLE' .

                  这篇关于如何在mongodb中找到数组的最后一项?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Is Joomla 2.5 much faster than Joomla 1.5 Querywise(Joomla 2.5 比 Joomla 1.5 Querywise 快得多吗)
                  How to share Joomla login session from one joomla website to one ASP.Net MVC website(如何将 Joomla 登录会话从一个 joomla 网站共享到一个 ASP.Net MVC 网站)
                  htaccess redirect root to subdirectory but allow index.php in root AND query strings to function(htaccess 将根重定向到子目录,但允许根和查询字符串中的 index.php 起作用)
                  Joomla include database functions(Joomla 包含数据库功能)
                  nl2br() not working when displaying SQL results(显示 SQL 结果时 nl2br() 不起作用)
                  Joomla 2.5 JFactory::getSession(); seems to be caching in firefox(Joomla 2.5 JFactory::getSession();似乎在 Firefox 中缓存)

                2. <i id='SJbZO'><tr id='SJbZO'><dt id='SJbZO'><q id='SJbZO'><span id='SJbZO'><b id='SJbZO'><form id='SJbZO'><ins id='SJbZO'></ins><ul id='SJbZO'></ul><sub id='SJbZO'></sub></form><legend id='SJbZO'></legend><bdo id='SJbZO'><pre id='SJbZO'><center id='SJbZO'></center></pre></bdo></b><th id='SJbZO'></th></span></q></dt></tr></i><div id='SJbZO'><tfoot id='SJbZO'></tfoot><dl id='SJbZO'><fieldset id='SJbZO'></fieldset></dl></div>

                  1. <small id='SJbZO'></small><noframes id='SJbZO'>

                      <bdo id='SJbZO'></bdo><ul id='SJbZO'></ul>
                        <tbody id='SJbZO'></tbody>

                          • <legend id='SJbZO'><style id='SJbZO'><dir id='SJbZO'><q id='SJbZO'></q></dir></style></legend>
                            <tfoot id='SJbZO'></tfoot>