Skip to content

Commit

Permalink
adding Fergs enhancements to ensureIndex
Browse files Browse the repository at this point in the history
  • Loading branch information
marcesher committed Apr 6, 2012
1 parent ac26e79 commit 7e15e33
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions core/DBCollection.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -400,9 +400,10 @@
]
*/
public array function ensureIndex(array fields, unique=false ){
public array function ensureIndex(array fields, unique=false, dropDups=false, sparse=false, background=false ){
var pos = 1;
var doc = {};
var options = {};
var indexName = "";
var fieldName = "";

Expand All @@ -417,8 +418,8 @@
indexName = listAppend( indexName, fieldName, "_");
}

var dbo = toMongo( doc );
collection.ensureIndex( dbo, "_#indexName#_", unique );
options = { "unique" = unique, "name" = "_#indexName#_", "dropDups" = dropDups, "sparse" = sparse, "background" = background};
collection.ensureIndex( toMongo( doc ), toMongo( options ) );

return getIndexes(collectionName, mongoConfig);
}
Expand Down

0 comments on commit 7e15e33

Please sign in to comment.