MongoDB Stores binary data

Source: Internet
Author: User
Tags base64

MongoDB 3.x stores binary data in a way that is not base64, although the query results in the MONGO client are displayed in base64 manner, please feel free to use. The following analysis stores the contents of the stored file. Base64 encoded data will grow by 1/3 as a concern.

First, look at MONGO's c-driver definition of binary type data. Note the following refers to JS, to be clear that the official offer to our mongo-client is the use of JS language.

Below I will save a picture, the picture of the hexdump as below

After inserting the data into the MONGO, the Mongo-client query is displayed as follows, our picture data is displayed as Base64 content, but do not panic, this is the JS language display, not the actual underlying storage.

Finally we look at the physical storage of this record

The conclusion is that MongoDB is actually storing binary data in binary way. Base64 encoded data will increase by 1/3 of the concerns can be waived.

MongoDB Stores binary data

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.