Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attempting to create a document with empty ID can create a database #109

Merged
merged 2 commits into from Mar 28, 2013

Conversation

edwag
Copy link
Contributor

@edwag edwag commented Mar 20, 2013

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<String, Object> document = new HashMap<String, Object>() {{
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.

Edward Wagstaff added 2 commits March 18, 2013 18:22
…ing could result in the creation of a new database, or an unhelpful error message.
helun pushed a commit that referenced this pull request Mar 28, 2013
Attempting to create a document with empty ID can create a database
@helun helun merged commit 9424ea2 into helun:master Mar 28, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants