A
A
Artem Prokhorov2022-02-13 12:01:50
MongoDB
Artem Prokhorov, 2022-02-13 12:01:50

What type of data will be more optimal for a field where 1 digit will be used?

Do you mean int or string (with a minimum and maximum value)? Int 32-bit.
By 1 digit it means that the value will be from 0 to 9, 1 character.
What will eat less memory?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
rPman, 2022-02-13
@kotcich

mongodb supports compression, so store in int (and values ​​​​from 0 to 9 and not a character code) then zeros in the database will be optimized and compressed
if you need to store a lot of data within one document - use BinData this is bson serialization, it seems to be very efficient
well and if you just need to store a list of numbers in the document, then the
ps lines my gut senses that an inappropriate tool is being used for the task

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question