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

    <legend id='p0XMC'><style id='p0XMC'><dir id='p0XMC'><q id='p0XMC'></q></dir></style></legend>
      <bdo id='p0XMC'></bdo><ul id='p0XMC'></ul>

    1. <tfoot id='p0XMC'></tfoot>

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

        mongodb 从不同的数据库中选择

        mongodb select from different databases(mongodb 从不同的数据库中选择)

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

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

              • <bdo id='q4eut'></bdo><ul id='q4eut'></ul>
                1. <tfoot id='q4eut'></tfoot>
                  <i id='q4eut'><tr id='q4eut'><dt id='q4eut'><q id='q4eut'><span id='q4eut'><b id='q4eut'><form id='q4eut'><ins id='q4eut'></ins><ul id='q4eut'></ul><sub id='q4eut'></sub></form><legend id='q4eut'></legend><bdo id='q4eut'><pre id='q4eut'><center id='q4eut'></center></pre></bdo></b><th id='q4eut'></th></span></q></dt></tr></i><div id='q4eut'><tfoot id='q4eut'></tfoot><dl id='q4eut'><fieldset id='q4eut'></fieldset></dl></div>
                  本文介绍了mongodb 从不同的数据库中选择的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我有大约 200 个 mongodb 数据库.每个数据库都有一个名为Group"的集合,在这个集合中有一个名为meldingId"的字段.

                  I have about 200 mongodb databases. Every database has a collection called 'Group' and in this collection there is a field called 'meldingId'.

                  是否可以进行一个 mongodb 查询来查找不同数据库中的所有值.

                  Is it possible to make a one mongodb query which find all values in the different databases.

                  (我设法通过 selectDB($database_name) 选择数据库 bij 循环遍历数据库)

                  (I managed to select the databases bij looping through the databases by selectDB($database_name))

                  推荐答案

                  在 Mongo shell 中,这可以通过使用 db.getSiblingDB() 方法切换到管理数据库并通过运行获取 200 个数据库的列表管理命令 db.runCommand({ "listDatabases": 1 }).遍历数据库列表并使用 db.getSiblingDB() 再次在数据库之间切换,查询 Group 集合的 meldingId 值.像这样:

                  In Mongo shell, this can be done by using db.getSiblingDB() method to switch to admin database and get a list of the 200 databases by running the admin command db.runCommand({ "listDatabases": 1 }). Iterate over the list of databases and use db.getSiblingDB() again to switch between databases, query the Group collection for the meldingId values. Something like this:

                  // Switch to admin database and get list of databases.
                  db = db.getSiblingDB("admin");
                  dbs = db.runCommand({ "listDatabases": 1 }).databases;
                  
                  // Iterate through each database.
                  dbs.forEach(function(database) {
                      db = db.getSiblingDB(database.name);
                  
                      // Get the Group collection
                      collection = db.getCollection("Group");
                  
                      // Iterate through all documents in collection.
                      /*
                          collection.find().forEach(function(doc) {
                  
                              // Print the meldingId field.
                              print(doc.meldingId);
                          });
                      */
                  
                      var meldingIds = collection.distinct('meldingId');
                      print(meldingIds);
                  
                  });
                  

                  这篇关于mongodb 从不同的数据库中选择的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  DeepL的翻译效果还是很强大的,如果我们要用php实现DeepL翻译调用,该怎么办呢?以下是代码示例,希望能够帮到需要的朋友。 在这里需要注意,这个DeepL的账户和api申请比较难,不支持中国大陆申请,需要拥有香港或者海外信用卡才行,没账号的话,目前某宝可以
                  PHP通过phpspreadsheet导入Excel日期,导入系统后,全部变为了4开头的几位数字,这是为什么呢?原因很简单,将Excel的时间设置问文本,我们就能看到该日期本来的数值,上图对应的数值为: 要怎么解决呢?进行数据转换就行,这里可以封装方法,或者用第三方的
                  mediatemple - can#39;t send email using codeigniter(mediatemple - 无法使用 codeigniter 发送电子邮件)
                  Laravel Gmail Configuration Error(Laravel Gmail 配置错误)
                  Problem with using PHPMailer for SMTP(将 PHPMailer 用于 SMTP 的问题)
                  Issue on how to setup SMTP using PHPMailer in GoDaddy server(关于如何在 GoDaddy 服务器中使用 PHPMailer 设置 SMTP 的问题)
                2. <legend id='OdyPA'><style id='OdyPA'><dir id='OdyPA'><q id='OdyPA'></q></dir></style></legend>

                    <tbody id='OdyPA'></tbody>

                    <tfoot id='OdyPA'></tfoot>
                  • <small id='OdyPA'></small><noframes id='OdyPA'>

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

                          <bdo id='OdyPA'></bdo><ul id='OdyPA'></ul>