Skip to content

Commit d799975

Browse files
committed
JAVA-814: Remove findOne check for index existence in createIndex method. It's not necessary, and it causes an error on text indices on "$**" field.
1 parent f827915 commit d799975

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

src/main/com/mongodb/DBApiLayer.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -337,10 +337,7 @@ public void createIndex( final DBObject keys, final DBObject options, DBEncoder
337337
full.put( k , options.get( k ) );
338338
full.put( "key" , keys );
339339

340-
MyCollection idxs = DBApiLayer.this.doGetCollection( "system.indexes" );
341-
//query first, maybe we should do an update w/upsert? -- need to test performance and lock behavior
342-
if ( idxs.findOne( full ) == null )
343-
idxs.insert(Arrays.asList(full), false, WriteConcern.SAFE, encoder);
340+
DBApiLayer.this.doGetCollection( "system.indexes" ).insert(Arrays.asList(full), false, WriteConcern.SAFE, encoder);
344341
}
345342

346343
final String _fullNameSpace;

0 commit comments

Comments
 (0)