I am using createIndex() in MongoDB in Node.js. I was wondering how I could insert a variable into createIndex.
For instance I have var x = "insert". I would like to make an index called "insert" by using x. I have tried createIndex({x:1}) but all this does is make x the index.