|
@@ -35,18 +35,18 @@ final class UpdatesMongoHandler implements HttpHandler {
|
|
World[] worlds = new World[queries];
|
|
World[] worlds = new World[queries];
|
|
for (int i = 0; i < queries; i++) {
|
|
for (int i = 0; i < queries; i++) {
|
|
int id = Helper.randomWorld();
|
|
int id = Helper.randomWorld();
|
|
- DBObject key = new BasicDBObject("id", id);
|
|
|
|
|
|
+ DBObject key = new BasicDBObject("_id", id);
|
|
//
|
|
//
|
|
// The requirements for the test dictate that we must fetch the World
|
|
// The requirements for the test dictate that we must fetch the World
|
|
// object from the data store and read its randomNumber field, even though
|
|
// object from the data store and read its randomNumber field, even though
|
|
// we could technically avoid doing either of those things and still
|
|
// we could technically avoid doing either of those things and still
|
|
// produce the correct output and side effects.
|
|
// produce the correct output and side effects.
|
|
//
|
|
//
|
|
- DBObject object = database.getCollection("world").findOne(key);
|
|
|
|
|
|
+ DBObject object = database.getCollection("World").findOne(key);
|
|
int oldRandomNumber = ((Number) object.get("randomNumber")).intValue();
|
|
int oldRandomNumber = ((Number) object.get("randomNumber")).intValue();
|
|
int newRandomNumber = Helper.randomWorld();
|
|
int newRandomNumber = Helper.randomWorld();
|
|
object.put("randomNumber", newRandomNumber);
|
|
object.put("randomNumber", newRandomNumber);
|
|
- database.getCollection("world").update(key, object);
|
|
|
|
|
|
+ database.getCollection("World").update(key, object);
|
|
worlds[i] = new World(id, newRandomNumber);
|
|
worlds[i] = new World(id, newRandomNumber);
|
|
}
|
|
}
|
|
exchange.getResponseHeaders().put(
|
|
exchange.getResponseHeaders().put(
|