MongoDB
 Computer >> コンピューター >  >> プログラミング >> MongoDB

Mongoシェルのすべてのコレクションを一覧表示するにはどうすればよいですか?


Mongoシェルのすべてのコレクションを一覧表示するには、関数getCollectionNames()を使用できます。

構文は次のとおりです-

 db.getCollectionNames(); 

コレクションである別のコマンドを使用できます。構文は次のとおりです-

コレクションを表示;

Mongoのすべてのコレクションを一覧表示するには、上記の2つの関数を使用します。クエリは次のとおりです-

> db.getCollectionNames(); 

以下は出力です-

 ["ConvertStringToDateDemo"、 "IdUpdateDemo"、 "ProductsInformation"、 "addFieldDemo"、 "addNewFieldToEveryDocument"、 "arrayInnerElementsDemo"、 "arrayLengthGreaterThanOne"、 "arrayOfArraysDemo"、 "caseInsensitiveDemo"、 "changeDataType"、 "changeType"、 "charactersAllowed "、" charactersDemo "、" checkFieldContainsStringDemo "、" checkSequenceDemo "、" combinationOfArrayDemo "、" conditionalSumDemo "、" convertStringToNumberDemo "、" copyThisCollectionToSampleDatabaseDemo "、" countDemo "、" createSequenceDemo "、" distinctCountValuesDemo "、" dis "employeeInformation"、 "filterArray"、 "findAllDuplicateKeyDocumentDemo"、 "findByMultipleArrayDemo"、 "findDuplicateByKeyDemo"、 "findDuplicateRecordsDemo"、 "findSpecificValue"、 "findValueInArrayWithMultipleCriteriaDemo"、 "getLastNRecordsDemo"、 "getParticularElementFromArrayDemo" "、" inc rementValueInNestedArrayDemo "、" insertIfNotExistsDemo "、" nestedArrayDemo "、" notLikeOpeartorDemo "、" regExpOnIntegerDemo "、" removeArrayDemo "、" removeArrayElement "、" removeArrayElements "、" removeDuplicateDocumentDemo "、" removeElementFromDoublyNestedArray " 、"reverseRegexDemo"、 "searchArrayDemo"、 "selectSingleFieldDemo"、 "singleFieldDemo"、 "sortDemo"、 "sortInnerArrayDemo"、 "sourceCollection"、 "stringFieldLengthDemo"、 "test.js"、 "uniqueIndexOnArrayDemo"、 "unwindOperatorDemo"、 "updateExactField" 、"updateIdDemo"、 "updateObjects"] 

これは、Mongoのすべてのコレクションを表示する2番目のクエリです。クエリは次のとおりです-

>コレクションを表示;

以下は出力です-

<前> ConvertStringToDateDemoIdUpdateDemoProductsInformationaddFieldDemoaddNewFieldToEveryDocumentarrayInnerElementsDemoarrayLengthGreaterThanOnearrayOfArraysDemocaseInsensitiveDemochangeDataTypechangeTypecharactersAllowedDemocharactersDemocheckFieldContainsStringDemocheckSequenceDemocombinationOfArrayDemoconditionalSumDemoconvertStringToNumberDemocopyThisCollectionToSampleDatabaseDemocountDemocreateSequenceDemodistinctCountValuesDemodistinctRecordDemodistinctWithMultipleKeysDemoemployeeInformationfilterArrayfindAllDuplicateKeyDocumentDemofindByMultipleArrayDemofindDuplicateByKeyDemofindDuplicateRecordsDemofindSpecificValuefindValueInArrayWithMultipleCriteriaDemogetLastNRecordsDemogetParticularElementFromArrayDemogetPartuclarElementgetSizeOfArraygroupByDateDemoincrementValueInNestedArrayDemoinsertIfNotExistsDemonestedArrayDemonotLikeOpeartorDemoregExpOnIntegerDemoremoveArrayDemoremoveArrayElementremoveArrayElementsremoveDuplicateDocumentDemoremoveElementFromDoublyNestedArrayDemoremoveFi eldCompletlyDemoremoveObjectrenameFieldDemoreverseRegexDemosearchArrayDemoselectSingleFieldDemosingleFieldDemosortDemosortInnerArrayDemosourceCollectionstringFieldLengthDemotest.jsuniqueIndexOnArrayDemounwindOperatorDemoupdateExactFieldupdateIdDemoupdateObjects
  1. Linuxシェルの使用方法

    コンシューマーグレードのLinuxディストリビューションは、強力なグラフィカルユーザーインターフェイスを提供しますが、Linuxは1970年代のUnixの世界で生まれたため、特定のGUIに依存しないアーキテクチャで実行されます。 システムへのテキストベースのエントリポイントは、シェルと呼ばれます。 、およびLinuxはそれらのいくつかをサポートしています。 シェルとは何ですか? シェルは、コンピュータのオペレーティングシステムと対話するテキストベースの方法であり、コマンドインタプリタと呼ばれる関数です。 。シェルは独自の構文とロジックを使用します。これらは、ログインしたユーザーとコンピ

  2. Windows10コンピューターにインストールされているすべてのプリンターを一覧表示する方法

    Windowsコンピューターに複数のプリンターをインストールできます。多くのプリンタをインストールした場合、インストールされているすべてのプリンタを一覧表示することをお勧めします。今日は、さまざまな方法を使用してこのタスクを実行する方法を紹介します。メソッド。 Windows10にインストールされているすべてのプリンターを一覧表示する 次の4つの方法を使用して、Windows10にインストールされているすべてのプリンターを一覧表示できます。 コントロールパネルの使用。 Windows10設定アプリ経由。 WindowsPowerShellを使用します。 コマンドプロンプトの使用。 これ