C
C
cnaize2013-12-06 18:05:38
Erlang
cnaize, 2013-12-06 18:05:38

Why do models have strange IDs (hash)?

Hello. Please explain why my models have such strange IDs.

{myrecord,"myrecord-52a1dd5e4346e109ba000001",<<"123">>}

How can I find a record if I get a regular id. How can I find out this hash that is generated before the ID? Is there any way to fix this so it looks like {myrecord,"myrecord-1",<<"123">>}. Maybe there is some kind of base setting?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Arkady Butermanov, 2013-12-07
@cnaize

The fact is that the document id in the MongoDB database is a hash of a string formed by the concatenation of the computer name on which the process is running, the process number and a numeric counter. This kind of identifier provides a much greater uniqueness of the document. This is the method chosen by the MongoDB developers, you will have to put up with it) You can read more about it here: docs.mongodb.org/manual/reference/object-id
UPD: the current Timestamp is also included in the concatenation.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question