Skip to content

Commit 979b25e

Browse files
committed
added index type parameter to ensureIndex
- required to create geo index for geoNear test
1 parent 0cc52e5 commit 979b25e

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/Adapters/Storage/Mongo/MongoStorageAdapter.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -682,15 +682,16 @@ export class MongoStorageAdapter implements StorageAdapter {
682682
schema: SchemaType,
683683
fieldNames: string[],
684684
indexName: ?string,
685-
caseInsensitive: boolean = false
685+
caseInsensitive: boolean = false,
686+
indexType: any = 1
686687
): Promise<any> {
687688
schema = convertParseSchemaToMongoSchema(schema);
688689
const indexCreationRequest = {};
689690
const mongoFieldNames = fieldNames.map(fieldName =>
690691
transformKey(className, fieldName, schema)
691692
);
692693
mongoFieldNames.forEach(fieldName => {
693-
indexCreationRequest[fieldName] = 1;
694+
indexCreationRequest[fieldName] = indexType;
694695
});
695696

696697
const defaultOptions: Object = { background: true, sparse: true };

src/Adapters/Storage/StorageAdapter.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,8 @@ export interface StorageAdapter {
9292
schema: SchemaType,
9393
fieldNames: string[],
9494
indexName?: string,
95-
caseSensitive?: boolean
95+
caseSensitive?: boolean,
96+
indexType?: any
9697
): Promise<any>;
9798
ensureUniqueness(
9899
className: string,

0 commit comments

Comments
 (0)