MongoDB Tip: Create Short Field Names
MongoDB’s dynamic schema and document-based data structure offer a lot of flexibility in development, but it’s important to understand how your document construction can affect available memory in your application. It’s incredibly valua
MongoDB’s dynamic schema and document-based data structure offer a lot of flexibility in development, but it’s important to understand how your document construction can affect available memory in your application. It’s incredibly valuable to optimize storage size of your documents, and one easy way to do this is by shortening your field names.
MongoDB stores all field names in each BSON document. In most cases the space is inconsequential, but when your data set grows to include millions of documents (and potentially collections), the extra bytes in long field names can add up. If document or schema overhead is a significant concern, consider shortening your field names.
For example, instead of the field names in the following document:
{ first_name: ?“Joseph”, address: “345 Caroll Street” , telephone: “19176253475”}
Consider shortening the names to:
{ fname: ?“Joseph”, addr: “345 Caroll Street” , tel: “19176253475”}
The Use Case
One case where this might be useful is when you are logging real-time data points such as web stats. Here, you have many small documents being added every minute, second and hour of the day. You might have a document that looks like this:
{"_id" : "512d35b0400fed3b997cd9c9" ,
"hour" : "Thu Mar 05 2013 10:00:00 GMT-0500 (EST)" ,
"site" : "abc" , "u" : 1 ,
"pageviews" : 1}
Having longer field names could end up taking up a lot of disk space over time, while using shorter field names with have a larger impact on your disk savings. Consider cutting down your field names like so:
{"_id" : "512d35b0400fed3b997cd9c9" ,
"h" : "Thu Mar 05 2013 10:00:00 GMT-0500 (EST)" ,
"s" : "abc" , "u" : 1 ,
"pv" : 1}
Depending on your document size, using shorter field names will have a tangible benefit to your application.
- Learn more about MongoDB for Analytics
Update: Here is a link to the two server tickets that are being worked on to optimize document storage at the database level.?
- SERVER-863
- SERVER-164
原文地址:MongoDB Tip: Create Short Field Names, 感谢原作者分享。

ホットAIツール

Undresser.AI Undress
リアルなヌード写真を作成する AI 搭載アプリ

AI Clothes Remover
写真から衣服を削除するオンライン AI ツール。

Undress AI Tool
脱衣画像を無料で

Clothoff.io
AI衣類リムーバー

AI Hentai Generator
AIヘンタイを無料で生成します。

人気の記事

ホットツール

メモ帳++7.3.1
使いやすく無料のコードエディター

SublimeText3 中国語版
中国語版、とても使いやすい

ゼンドスタジオ 13.0.1
強力な PHP 統合開発環境

ドリームウィーバー CS6
ビジュアル Web 開発ツール

SublimeText3 Mac版
神レベルのコード編集ソフト(SublimeText3)

ホットトピック









最新の機能と改善が提供される MongoDB の最新バージョン (現在 5.0) を使用することをお勧めします。バージョンを選択するときは、機能要件、互換性、安定性、コミュニティ サポートを考慮する必要があります。たとえば、最新バージョンにはトランザクションや集計パイプラインの最適化などの機能が備わっています。バージョンがアプリケーションと互換性があることを確認してください。運用環境の場合は、長期サポート バージョンを選択してください。最新バージョンでは、より積極的なコミュニティサポートが提供されています。

Node.js はサーバー側の JavaScript ランタイムであり、Vue.js は対話型ユーザー インターフェイスを作成するためのクライアント側の JavaScript フレームワークです。 Node.js はバックエンド サービス API 開発やデータ処理などのサーバー側開発に使用され、Vue.js はシングルページ アプリケーションや応答性の高いユーザー インターフェイスなどのクライアント側開発に使用されます。

MongoDB データベースのデータは、ローカル ファイル システム、ネットワーク ファイル システム、またはクラウド ストレージに配置できる指定されたデータ ディレクトリに保存されます。具体的な場所は次のとおりです: ローカル ファイル システム: デフォルトのパスは Linux/macOS: /data/db、Windows: C:\data\db。ネットワーク ファイル システム: パスはファイル システムによって異なります。クラウド ストレージ: パスはクラウド ストレージ プロバイダーによって決定されます。

MongoDB データベースは、その柔軟性、スケーラビリティ、および高いパフォーマンスで知られています。その利点には、データを柔軟かつ非構造化された方法で保存できるドキュメント データ モデルが含まれます。シャーディングによる複数サーバーへの水平スケーラビリティ。クエリの柔軟性により、複雑なクエリと集計操作をサポートします。データ レプリケーションとフォールト トレランスにより、データの冗長性と高可用性が確保されます。 JSON サポートにより、フロントエンド アプリケーションと簡単に統合できます。大量のデータを処理する場合でも高速な応答を実現する高いパフォーマンス。オープンソースでカスタマイズ可能で無料で使用できます。

MongoDB は、大量の構造化データと非構造化データを保存および管理するために使用されるドキュメント指向の分散データベース システムです。その中心的な概念にはドキュメントのストレージと配布が含まれ、その主な機能には動的スキーマ、インデックス作成、集約、マップリデュース、レプリケーションが含まれます。コンテンツ管理システム、電子商取引プラットフォーム、ソーシャル メディア Web サイト、IoT アプリケーション、モバイル アプリケーション開発で広く使用されています。

Linux/macOS の場合: データ ディレクトリを作成し、「mongod」サービスを開始します。 Windows の場合: データ ディレクトリを作成し、Service Manager から MongoDB サービスを開始します。 Docker の場合: 「docker run」コマンドを実行します。他のプラットフォームの場合: MongoDB のドキュメントを参照してください。確認方法: 「mongo」コマンドを実行して接続し、サーバーのバージョンを確認します。

MongoDB データベース ファイルは、MongoDB データ ディレクトリにあります。デフォルトでは /data/db です。このディレクトリには、.bson (ドキュメント データ)、ns (コレクション情報)、journal (書き込み操作レコード)、wiredTiger (WiredTiger 使用時のデータ) が含まれています。ストレージ エンジン ) および config (データベース構成情報) およびその他のファイル。

Navicat の有効期限の問題を解決するには、ライセンスを更新する、自動更新を無効にする、Navicat プレミアム エッセンシャルの無料バージョンを使用する、などがあります。
