helun/Ektorp — pull request #109 by edwag (2013-03-20 11:47:06+00:00)
Title: Attempting to create a document with empty ID can create a database

The following code will create the database "foo" if it doesn't already exist. This patch fixes that issue.

HttpClient httpClient = new StdHttpClient.Builder().build();
CouchDbInstance dbInstance = new StdCouchDbInstance(httpClient);
CouchDbConnector db = dbInstance.createConnector("foo", false);

Map document = new HashMap() {{
put("_id", "");
put("field", 12345);
}};

db.create(document); // Sends a PUT request to localhost:5984/foo/, which creates a new DB rather than a new document.