mongodb/mongo — pull request #666 by santoshbanda (2014-04-14 18:04:28+00:00)
Title: SERVER-3260 prefix indexing

Summary:
Functionality to add prefix index on a single field of type
string or binary data is added here. Syntax to add a prefix index is
db.bar.ensureIndex( { a : "prefix" }). Default prefix length is 100 but
it can be changed during the index creation using the syntax
db.bar.ensureIndex( {a : "prefix" }, {"prefixLength" : 8});

Prefix indexes is compatible in all comparison operatoins
($lt, $gt, $eq, $lte, $gte) and in $in operation.
This index is not used in any other operations.

Note that if two documents have same prefix for the prefix indexed field,
the query will return both the results.

Test Plan:
Added a jstest to verify the functionality of prefix indexes