久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

    1. <i id='gA01t'><tr id='gA01t'><dt id='gA01t'><q id='gA01t'><span id='gA01t'><b id='gA01t'><form id='gA01t'><ins id='gA01t'></ins><ul id='gA01t'></ul><sub id='gA01t'></sub></form><legend id='gA01t'></legend><bdo id='gA01t'><pre id='gA01t'><center id='gA01t'></center></pre></bdo></b><th id='gA01t'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='gA01t'><tfoot id='gA01t'></tfoot><dl id='gA01t'><fieldset id='gA01t'></fieldset></dl></div>
    2. <small id='gA01t'></small><noframes id='gA01t'>

    3. <legend id='gA01t'><style id='gA01t'><dir id='gA01t'><q id='gA01t'></q></dir></style></legend>
        <bdo id='gA01t'></bdo><ul id='gA01t'></ul>

      <tfoot id='gA01t'></tfoot>

      如何在 mongodb 的數組頂部添加一個值?

      how do i add a value to the top of an array in mongodb?(如何在 mongodb 的數組頂部添加一個值?)
      <legend id='9d5Jm'><style id='9d5Jm'><dir id='9d5Jm'><q id='9d5Jm'></q></dir></style></legend>

      <small id='9d5Jm'></small><noframes id='9d5Jm'>

        <tbody id='9d5Jm'></tbody>

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

          • <bdo id='9d5Jm'></bdo><ul id='9d5Jm'></ul>

              <tfoot id='9d5Jm'></tfoot>
                本文介紹了如何在 mongodb 的數組頂部添加一個值?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                問題描述

                如何在 mongodb 的數組頂部添加一個值?

                how do i add a value to the top of an array in mongodb?

                假設我的 mongo 收藏中有此文檔:

                say i have this document in my mongo collection:

                { "colors" : [ "red", "green", "blue" ] }
                

                如何在列表前面添加黃色"?

                how do i add "yellow" to the front of the list?

                當我這樣做時:

                {$push:{colors:"yellow"}}
                

                我會得到這個:

                { "colors" : [ "red", "green", "blue", "yellow" ] }
                

                我想要這個:

                { "colors" : [ "yellow", "red", "green", "blue"] }
                

                提前致謝!

                推薦答案

                "unshift" 在數組的前面插入數據.. 而"push" 在末尾插入數據.例如在 JavaScript 中:

                "unshift" inserts data in the front of an array.. whereas "push" inserts it at the end. e.g. in JavaScript:

                > a = ['red','green','blue']
                [ "red", "green", "blue" ]
                > a.unshift("yellow")
                4
                > a
                [ "yellow", "red", "green", "blue" ]
                

                但不幸的是,Mongo API 不支持將其作為原子操作:

                But unfortunately this isn't supported by the Mongo API as an atomic operation:

                http://www.mongodb.org/display/DOCS/Updating

                它只支持推送"

                您的陣列有多大?

                你可以假設你在 Mongo 中的數組總是反向存儲,并使用 push,或者你可以讀出數組,用 unshift 修改它,然后再次存儲它(雖然這不是原子的)

                you could ether assume that your array in Mongo is always stored in reverse, and use push, or you could read-out the array, modify it with unshift, and then store it again (which wouldn't be atomic though)

                這篇關于如何在 mongodb 的數組頂部添加一個值?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                相關文檔推薦

                Check if a polygon point is inside another in leaflet(檢查一個多邊形點是否在傳單中的另一個內部)
                Changing leaflet markercluster icon color, inheriting the rest of the default CSS properties(更改傳單標記群集圖標顏色,繼承其余默認 CSS 屬性)
                Trigger click on leaflet marker(觸發點擊傳單標記)
                How can I change the default loading tile color in LeafletJS?(如何更改 LeafletJS 中的默認加載磁貼顏色?)
                Adding Leaflet layer control to sidebar(將 Leaflet 圖層控件添加到側邊欄)
                Leaflet - get latitude and longitude of a marker inside a pop-up(Leaflet - 在彈出窗口中獲取標記的緯度和經度)
                <tfoot id='Yl710'></tfoot>
              • <small id='Yl710'></small><noframes id='Yl710'>

                  1. <legend id='Yl710'><style id='Yl710'><dir id='Yl710'><q id='Yl710'></q></dir></style></legend>
                      <tbody id='Yl710'></tbody>

                  2. <i id='Yl710'><tr id='Yl710'><dt id='Yl710'><q id='Yl710'><span id='Yl710'><b id='Yl710'><form id='Yl710'><ins id='Yl710'></ins><ul id='Yl710'></ul><sub id='Yl710'></sub></form><legend id='Yl710'></legend><bdo id='Yl710'><pre id='Yl710'><center id='Yl710'></center></pre></bdo></b><th id='Yl710'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='Yl710'><tfoot id='Yl710'></tfoot><dl id='Yl710'><fieldset id='Yl710'></fieldset></dl></div>
                    • <bdo id='Yl710'></bdo><ul id='Yl710'></ul>
                        • 主站蜘蛛池模板: 久产久精国产品 | 天堂一区二区三区 | 亚洲综合一区二区三区 | 久久欧美高清二区三区 | 国产精品一区视频 | 综合亚洲视频 | 日韩欧美在线视频播放 | 美女爽到呻吟久久久久 | 欧美日韩一区二区三区视频 | 精品久久香蕉国产线看观看亚洲 | 欧美片网站免费 | 91看片网 | 欧美精品一区二区三 | 97免费在线视频 | 天天干天天谢 | 日韩a v在线免费观看 | 国产成人精品a视频一区www | 免费观看一级毛片视频 | 91福利影院 | 喷水毛片 | 欧美高清一级片 | 成人午夜精品 | 亚洲天堂中文字幕 | 国产一区二区中文字幕 | 超碰伊人 | 日韩欧美综合在线视频 | 噜啊噜在线 | 亚洲视频在线观看 | 四虎永久免费黄色影片 | 91九色porny首页最多播放 | 免费看黄色小视频 | 99精品国产一区二区青青牛奶 | 在线91| 欧美日韩在线精品 | 久久久久久亚洲精品 | 国产一二三视频在线观看 | 国产伦精品一区二区三区精品视频 | 九九热免费看 | 国产精品日韩欧美一区二区三区 | 国产成人99久久亚洲综合精品 | 国产精品免费视频一区 |