सभी डेटाबेस से सभी संग्रह प्राप्त करने के लिए, आइए सबसे पहले निम्नलिखित क्वेरी का उपयोग करके सभी डेटाबेस प्राप्त करें
> switchDatabaseAdmin =db.getSiblingDB("admin");admin> allDatabaseName =switchDatabaseAdmin.runCommand({"listDatabases":1}).डेटाबेस;
यह निम्नलिखित आउटपुट उत्पन्न करेगा
[ { "नाम":"व्यवस्थापक", "आकारऑनडिस्क":495616, "खाली":झूठा}, {"नाम":"कॉन्फ़िगर", "आकारऑनडिस्क":98304, "खाली":झूठा}, { " नाम":"स्थानीय", "आकारऑनडिस्क":73728, "खाली":झूठा}, {"नाम":"नमूना", "आकारऑनडिस्क":1335296, "खाली":झूठा}, {"नाम":"नमूना डेमो" , "sizeOnDisk" :278528, "खाली" :false }, { "name" :"studentSearch", "sizeOnDisk" :262144, "खाली" :false }, { "name" :"test", "sizeOnDisk" :8724480 , "खाली" :असत्य }]
डेटाबेस से सभी संग्रह नाम प्राप्त करने की क्वेरी निम्नलिखित है
> allDatabaseName.forEach(function(databaseName)... {... db =db.getSiblingDB(databaseName.name);... collectionName =db.getCollectionNames();... collectionName.forEach(function( संग्रहनाम)... {... प्रिंट (संग्रहनाम);...});...});
यह निम्नलिखित आउटपुट उत्पन्न करेगा
clearingItemsInNestedArrayDemocustomIdDemodeleteRecordDemodocumentExistsOrNotDemofindAllExceptFromOneOrtwoDemomongoExportDemostartup_logarraySizeErrorDemobasicInformationDemocopyThisCollectionToSampleDatabaseDemodeleteAllRecordsDemodeleteDocumentsdeleteDocumentsDemodeleteSomeInformationdocumentWithAParticularFieldValueDemoemployeefindListOfIdsDemofindSubstringgetAllRecordsFromSourceCollectionDemogetElementWithMaxIdDemointernalArraySizeDemolargestDocumentDemomakingStudentInformationCloneoppositeAddToSetDemoprettyDemoreturnOnlyUniqueValuesDemoselectWhereInDemosourceCollectionstudentInformationsumOfValueDemotruncateDemoupdateInformationuserInformationcopyThisCollectionToSampleDatabaseDemodeleteDocumentsdeleteDocumentsDemodeleteInformationemployeeinternalArraySizeDemoprettyDemosourceCollectionupdateInformationuserInformationcol1col2indexingForArrayElementDemoremoveObjectFromArrayDemospecifyAKeyDemouseVariableDemoConvertStringToDateDemoEmployee_InformationIdUpdateDemoIndexingDemoNotAnd DemoProductsInformationaddCurrentDateTimeDemoaddFieldDemoaddNewFieldToEveryDocumentaggregateSumDemoaggregationFrameworkWithOrMatchDemoaggregationSortDemoandOrDemoarrayInnerElementsDemoarrayLengthGreaterThanOnearrayOfArraysDemoavoidDuplicateEntriesDemocaseInsensitiveDemocaseInsesitiveDemocastingDemochangeDataTypechangeTypecharactersAllowedDemocharactersDemocheckFieldContainsStringDemocheckFieldExistsOrNotDemocheckSequenceDemocollectionOnDifferentDocumentDemocombinationOfArrayDemocomparingTwoFieldsDemoconcatStringAndIntDemoconditionalSumDemoconvertStringToNumberDemocopyThisCollectionToSampleDatabaseDemocountDemocountPerformanceDemocreateSequenceDemocreatingUniqueIndexDemodateDemodeleteAllElementsInArrayDemodeleteRecordDemodemo.insertCollectiondistinctAggregationdistinctCountValuesDemodistinctRecordDemodistinctWithMultipleKeysDemodoubleNestedArrayDemoembeddedCollectionDemoemployeeInformationequivalentForSelectColumn1Column2DemofieldIsNullOrNotSetDemofilterArrayfindAllDuplicateKeyDocumentD emofindAllNonDistinctDemofindByMultipleArrayDemofindDocumentDoNotHaveCertainFieldsfindDocumentNonExistenceFieldDemofindDocumentWithObjectIdDemofindDuplicateByKeyDemofindDuplicateRecordsDemofindMinValueDemofindSpecificValuefindValueInArrayWithMultipleCriteriaDemofirstDocumentDemofirstItemInArrayToNewFieldDemogetDistinctListOfSubDocumentFieldDemogetFirstItemDemogetIndexSizeDemogetLastNRecordsDemogetLastXRecordsDemogetNThElementDemogetParticularElementFromArrayDemogetPartuclarElementgetSizeDemogetSizeOfArraygettingHighestValueDemogroupByDateDemohideidDemoidentifyLastDocuementDemoincrementValueDemoincrementValueInNestedArrayDemoindexDemoindexOptimizationDemoindexTimeDemoindex_DemoindexingDemoinsertDemoinsertFieldWithCurrentDateDemoinsertIfNotExistsDemoinsertIntegerDemoinsertOneRecordDemolistAllValuesOfCeratinFieldsDemomatchBetweenFieldsDemomongoExportDemomultipleOrDemomy-collectionnestedArrayDemonestedIndexDemonestedObjectDemonew_CollectionnotLikeOpeartorDemonumberofKeysInADocumentDemoobje ctInAnArrayDemoobjectidToStringDemoorConditionDemoorDemoorderDocsDemopaginationDemoperformRegexpriceStoredAsStringDemopriceStoredDemoqueryArrayElementsDemoqueryByKeyDemoqueryBySubFieldDemoqueryForBooleanFieldsDemoqueryInSameDocumentsDemoqueryToEmbeddedDocumentqueryingMongoDbCaseInsensitiveDemoregExpOnIntegerDemoregexSearchDemoremoveArrayDemoremoveArrayElementremoveArrayElementByItsIndexDemoremoveArrayElementsremoveDocumentOnBasisOfIdremoveDuplicateDocumentDemoremoveDuplicateDocumentsremoveElementFromDoublyNestedArrayDemoremoveFieldCompletlyDemoremoveMultipleDocumentsDemoremoveObjectremovingidElementDemorenameFieldDemoretrieveValueFromAKeyDemoretunFieldInFindDemoreturnQueryFromDatereverseRegexDemossearchArrayDemosearchDocumentDemosearchDocumentWithSpecialCharactersDemosearchMultipleFieldsDemosecondDocumentDemoselectInWhereIdDemoselectMongoDBDocumentsWithSomeConditionselectRecordsHavingKeyDemoselectSingleFieldDemosingleFieldDemosortDemosortInnerArrayDemosortingDemosourceCollectionsqlLike DemostringFieldLengthDemostringToObjectIdDemotest.jstranslateDefinitionDemounconditionalUpdatesDemouniqueIndexOnArrayDemounprettyJsonDemounwindOperatorDemoupdateDemoupdateExactFieldupdateIdDemoupdateManyDocumentsDemoupdateNestedValueDemoupdateऑब्जेक्ट्सअपडेटिंग