[SERVER-37537] createIndex Command takes only one optional Parameter Created: 10/Oct/18  Updated: 27/Oct/23  Resolved: 10/Oct/18

Status: Closed
Project: Core Server
Component/s: Index Maintenance
Affects Version/s: 3.4.16, 4.0.1
Fix Version/s: None

Type: Question Priority: Major - P3
Reporter: Tanveer Madan Marate Assignee: Nick Brewer
Resolution: Works as Designed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Participants:

 Description   

Hi,

We are trying to create Index with below command

db.traffic_data.createIndex( {process: 1}, {storageEngine:{wiredTiger:

{configString:"block_compressor=zlib"}

}},{background: "True"}) 

It runs as foreground but but picks the storage options

The case is reversed when I use below command, it runs as background but without the storage options

db.traffic_data.createIndex( {process: 1},{background: "True"}, {storageEngine:{wiredTiger:

{configString:"block_compressor=zlib"}

}}) 

 

Thanks,



 Comments   
Comment by Tanveer Madan Marate [ 10/Oct/18 ]

Thanks Nick !!!

 

Comment by Nick Brewer [ 10/Oct/18 ]

tanveermadan The options should be passed to createIndex as a single document, not individually. Additionally, the value of Background should be a boolean rather than a string, so the correct syntax would be:

db.traffic_data.createIndex({process: 1}, {storageEngine: {wiredTiger: {configString:"block_compressor=zlib"}}, background: true});

Regards,
-Nick

Generated at Thu Feb 08 04:46:16 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.