runtime of using indexing in mongodb
问题 Based on mongodb documentation The ensureIndex() function only creates the index if it does not exist. Once a collection is indexed on a key, random access on query expressions which match the specified key are fast. Without the index, MongoDB has to go through each document checking the value of specified key in the query: db.things.find({j:2}); // fast - uses index db.things.find({x:3}); // slow - has to check all because 'x' isn't Does that mean the 1st line of code runtime is big_theta =