L
L
lssssssssssl2021-09-22 18:50:56
MongoDB
lssssssssssl, 2021-09-22 18:50:56

If you move a table from one database to another, keeping the old _id. Can there be any performance issues with the new database?

As far as I know, mongo stores some information for itself in these _ids. Or the data needs to be transferred so that mongo generates new _id in the new database, and cut off the old _id during transfer.
Or is there no difference at all?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrew Hecc, 2021-09-22
@lsssssssssl

The answer to this question lies in understanding what an ObjectId is in MongoDB.
ObjectID is 12 bytes of information which consists of:
- 4 bytes. Creation date timestamp
- 5 bytes. Random number
- 3 bytes. Incremental counter
There is no information that stores any specific data about the collection or the object itself.
You can try to use the service to get a timestamp from any _Id.
In general, moving an object from one collection to another should not affect performance in any way.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question