In MongoDB, your documents would need to be structured like this:
{
key: "the key name"
value: 100
}
Then, you'd create an index:
db.myLookupTable.ensureIndex({key : 1})
It's not going to be O(1)
time though as it's not a Hash lookup. As explained here, indexes, by default, in MongoDB are B-tree based so that other types of operations are possible (like sorting which you could not get from a Hash-based index). B-trees are worst case O(log n)
.
You could also enable the Hashed indexes for an index in MongoDB:
db.myLookupTable.ensureIndex({key: "hashed" })
That limits the types of queries you can do on the index though. For example, range queries are not possible.