We can create a collection with WiredTiger engine and type=lsm
, but this feature is not mentioned in MongoDB documents:
db.createCollection(
"test",
{ storageEngine: { wiredTiger: {configString: "type=lsm"}}}
)
Once insert some documents and add an index, it seems WiredTiger really creates LSM files.
db.test.insert([
{ value: 1},
{ value: 2},
{ value: 3}
]) // Done in 16:04
db.test.createIndex(
{ value: 1 },
{ storageEngine: { wiredTiger: {configString: "type=lsm"}}}
) // Done in 19:59
$ ls -ltr
...
-rw-r--r--. 1 mongod mongod 16384 Jan 15 16:04 collection-0-1708338433081558809-000002.lsm
-rw-r--r--. 1 mongod mongod 16384 Jan 15 16:04 index-1-1708338433081558809.wt
-rw-r--r--. 1 mongod mongod 16384 Jan 15 19:59 index-3-1708338433081558809-000002.lsm
Collection and index value_1
seem like LSM-Tree, but index _id_
still seems like B-Tree.
How can I change engine type of index _id
?