Skip to content

Commit

Permalink
Merge branch 'master' of github.com:christkv/node-mongodb-native
Browse files Browse the repository at this point in the history
  • Loading branch information
christkv committed Jun 3, 2011
2 parents d6a9b7c + 0e49c1a commit 489f50d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/mongodb/commands/db_command.js
Expand Up @@ -116,11 +116,13 @@ DbCommand.createCreateIndexCommand = function(db, collectionName, fieldOrSpec, o
var indexes = [];
var keys;
var sparse;
var background;

// If the options is a hash
if(options instanceof Object) {
finalUnique = options['unique'] != null ? options['unique'] : false;
sparse = options['sparse'] != null ? options['sparse'] : false;
background = options['background'] != null ? options['background'] : false;
}

// Get all the fields accordingly
Expand Down Expand Up @@ -160,7 +162,8 @@ DbCommand.createCreateIndexCommand = function(db, collectionName, fieldOrSpec, o
// Build the selector
var selector = {'ns':(db.databaseName + "." + collectionName), 'key':fieldHash, 'name':indexName};
selector['unique'] = finalUnique;
selector['sparse'] = sparse;
selector['sparse'] = sparse;
selector['background'] = background;
// Create the insert command for the index and return the document
return new InsertCommand(db, db.databaseName + "." + DbCommand.SYSTEM_INDEX_COLLECTION, false).add(selector);
};
Expand Down

0 comments on commit 489f50d

Please sign in to comment.