Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does "v" mean in mongo index

In mongodb, we can use db.collection.getIndexes() to get all indexes, output is something like:

[
    {
        "v" : 2,
        "key" : {
            "_id" : 1
        },
        "name" : "_id_",
        "ns" : "counters"
    }
]

Most properties are pretty self-explanatory except for "v", can't seem to find any documentation about this. Does any one know what "v" means here? Thank in advance.

like image 931
Kennard Avatar asked May 12 '20 18:05

Kennard


People also ask

What is V MongoDB?

The __v field is called the version key. It describes the internal revision of a document. This __v field is used to track the revisions of a document. By default, its value is zero ( __v:0 ).

What is index type in MongoDB?

To support efficient queries of geospatial coordinate data, MongoDB provides two special indexes: 2d indexes that uses planar geometry when returning results and 2dsphere indexes that use spherical geometry to return results.

What is MongoDB index size?

collection. totalIndexSize() 4617080000. The above example shows an index size of almost 4.3 gigabytes. To ensure this index fits in RAM, you must not only have more than that much RAM available but also must have RAM available for the rest of the working set.

What is MongoDB index Key limit?

Index Key The total size of an indexed value must be less than 1024 bytes. MongoDB will not add that value to an index if it is longer than 1024 bytes. Using db. collection.


1 Answers

v is the version.

Version 0 has been disallowed since MongoDB 3.2,

I have heard that only version 2+ can be used with MongoDB 4.2, but I am unable to find a documentation link to confirm that.

See also: https://docs.mongodb.com/manual/core/2dsphere/#versions https://docs.mongodb.com/manual/core/index-text/#versions

like image 188
Joe Avatar answered Oct 04 '22 19:10

Joe