Skip to content

Commit 3f9a7c1

Browse files
committed
Fix case in obedientCommands
And revert the regression tests back after being incorrectly changed in 22a0a66 JAVA-1842
1 parent 862da58 commit 3f9a7c1

File tree

2 files changed

+22
-22
lines changed

2 files changed

+22
-22
lines changed

src/main/com/mongodb/DB.java

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ public abstract class DB {
5252
_obedientCommands.add("geowalk");
5353
_obedientCommands.add("text");
5454
_obedientCommands.add("parallelcollectionscan");
55-
_obedientCommands.add("listIndexes");
56-
_obedientCommands.add("listCollections");
55+
_obedientCommands.add("listindexes");
56+
_obedientCommands.add("listcollections");
5757
}
5858

5959
/**
@@ -119,10 +119,10 @@ ReadPreference getCommandReadPreference(DBObject command, ReadPreference request
119119

120120
/**
121121
* <p>Starts a new 'consistent request'</p>.
122-
*
122+
*
123123
* <p>Following this call and until {@link com.mongodb.DB#requestDone()} is called, all db operations will use the same underlying
124124
* connection.</p>
125-
*
125+
*
126126
* @deprecated The main use case for this method is to ensure that applications can read their own unacknowledged writes,
127127
* but this is no longer so prevalent since the driver started defaulting to acknowledged writes. The other main use case is to
128128
* ensure that related read operations are all routed to the same server when using a non-primary read preference. But this is
@@ -156,8 +156,8 @@ ReadPreference getCommandReadPreference(DBObject command, ReadPreference request
156156
public abstract void requestEnsureConnection();
157157

158158
/**
159-
* <p>Gets a collection with a given name. If the collection does not exist, a new collection is created.</p>
160-
*
159+
* <p>Gets a collection with a given name. If the collection does not exist, a new collection is created.</p>
160+
*
161161
* <p>This class is NOT part of the public API. Be prepared for non-binary compatible changes in minor releases.</p>
162162
*
163163
* @param name the name of the collection
@@ -177,15 +177,15 @@ public DBCollection getCollection( String name ){
177177
}
178178

179179
/**
180-
* <p>Creates a collection with a given name and options. If the collection already exists, this throws a
180+
* <p>Creates a collection with a given name and options. If the collection already exists, this throws a
181181
* {@code CommandFailureException}.</p>
182182
*
183183
* <p>Possible options:</p>
184-
* <ul>
185-
* <li> <b>capped</b> ({@code boolean}) - Enables a collection cap. False by default. If enabled,
186-
* you must specify a size parameter. </li>
187-
* <li> <b>size</b> ({@code int}) - If capped is true, size specifies a maximum size in bytes for the capped collection. When
188-
* capped is false, you may use size to preallocate space. </li>
184+
* <ul>
185+
* <li> <b>capped</b> ({@code boolean}) - Enables a collection cap. False by default. If enabled,
186+
* you must specify a size parameter. </li>
187+
* <li> <b>size</b> ({@code int}) - If capped is true, size specifies a maximum size in bytes for the capped collection. When
188+
* capped is false, you may use size to preallocate space. </li>
189189
* <li> <b>max</b> ({@code int}) - Optional. Specifies a maximum "cap" in number of documents for capped collections. You must
190190
* also specify size when specifying max. </li>
191191
* </ul>
@@ -262,9 +262,9 @@ public CommandResult command(final DBObject cmd, final DBEncoder encoder) {
262262
}
263263

264264
/**
265-
* Executes a database command. This method calls
266-
* {@link #command(com.mongodb.DBObject, int, com.mongodb.ReadPreference, com.mongodb.DBEncoder) } with the database default read
267-
* preference. The only option used by this method was "slave ok", therefore this method has been replaced with
265+
* Executes a database command. This method calls
266+
* {@link #command(com.mongodb.DBObject, int, com.mongodb.ReadPreference, com.mongodb.DBEncoder) } with the database default read
267+
* preference. The only option used by this method was "slave ok", therefore this method has been replaced with
268268
* {@link #command(DBObject, ReadPreference, DBEncoder)}.
269269
*
270270
* @param cmd {@code DBObject} representation the command to be executed
@@ -300,7 +300,7 @@ public CommandResult command( final DBObject cmd , final int options, final Read
300300
}
301301

302302
/**
303-
* Executes a database command. The only option used by this method was "slave ok", therefore this method has been replaced with
303+
* Executes a database command. The only option used by this method was "slave ok", therefore this method has been replaced with
304304
* {@link #command(DBObject, ReadPreference, DBEncoder)}.
305305
*
306306
* @param cmd A {@code DBObject} representation the command to be executed
@@ -583,10 +583,10 @@ public CommandResult getLastError(final com.mongodb.WriteConcern concern) {
583583
/**
584584
* Returns the error status of the last operation on the current connection.
585585
*
586-
* @param w when running with replication, this is the number of servers to replicate to before returning. A {@code w} value
587-
* of {@code 1} indicates the primary only. A {@code w} value of {@code 2} includes the primary and at least one
588-
* secondary, etc. In place of a number, you may also set {@code w} to majority to indicate that the command should
589-
* wait until the latest write propagates to a majority of replica set members. If using {@code w},
586+
* @param w when running with replication, this is the number of servers to replicate to before returning. A {@code w} value
587+
* of {@code 1} indicates the primary only. A {@code w} value of {@code 2} includes the primary and at least one
588+
* secondary, etc. In place of a number, you may also set {@code w} to majority to indicate that the command should
589+
* wait until the latest write propagates to a majority of replica set members. If using {@code w},
590590
* you should also use {@code wtimeout}. Specifying a value for {@code w} without also providing a {@code wtimeout} may
591591
* cause {@code getLastError} to block indefinitely.
592592
* @param wtimeout a value in milliseconds that controls how long to wait for write propagation to complete. If replication does not

src/test/com/mongodb/DBTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,10 +113,10 @@ public void shouldReturnCorrectValueForReadPreferenceDependingUponTheCommand() t
113113
assertEquals(ReadPreference.secondaryPreferred(), db.getCommandReadPreference(obj, ReadPreference.secondaryPreferred()));
114114

115115
obj = new BasicDBObject("listIndexes", 1);
116-
assertEquals(ReadPreference.primary(), db.getCommandReadPreference(obj, ReadPreference.secondaryPreferred()));
116+
assertEquals(ReadPreference.secondaryPreferred(), db.getCommandReadPreference(obj, ReadPreference.secondaryPreferred()));
117117

118118
obj = new BasicDBObject("listCollections", 1);
119-
assertEquals(ReadPreference.primary(), db.getCommandReadPreference(obj, ReadPreference.secondaryPreferred()));
119+
assertEquals(ReadPreference.secondaryPreferred(), db.getCommandReadPreference(obj, ReadPreference.secondaryPreferred()));
120120
}
121121

122122
@Test

0 commit comments

Comments
 (0)