Permalink
Browse files

adding Fergs enhancements to ensureIndex

  • Loading branch information...
1 parent ac26e79 commit 7e15e339f3097fea82eb3734a1c297941486c92b @marcesher committed Apr 6, 2012
Showing with 4 additions and 3 deletions.
  1. +4 −3 core/DBCollection.cfc
View
@@ -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 = "";
@@ -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);
}

0 comments on commit 7e15e33

Please sign in to comment.