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

MongoDB inserts succeed despite failing validation #54

Closed
maksim2042 opened this issue May 8, 2013 · 2 comments
Closed

MongoDB inserts succeed despite failing validation #54

maksim2042 opened this issue May 8, 2013 · 2 comments
Milestone

Comments

@maksim2042
Copy link

I submit a record that gets rejected by the validator -- but then, the record is inserted into MongoDB anyway.

gella:~ maksim$ curl -d 'item1={"username":"bobama", "firstname": "barack", "lastname": "2"}' 127.0.0.1:5000/people/

{"item1": {"status": "ERR", "issues": ["min length for field 'username' is 8"]}}

gella:~ maksim$ curl -d 'item1={"username":"bobama", "firstname": "barack", "lastname": "2"}' 127.0.0.1:5000/people/

{"item1": {"status": "ERR", "issues": ["min length for field 'username' is 8", "value 'bobama' for field 'username' not unique"]}}

In both cases, the inserts have failed. However, I list the records and get ….

{
"firstname": "barack",
"_links": {
"self": {
"href": "127.0.0.1:5000/people/518ab5cfe584f144b095c4bf/",
"title": "person"
}
},
"username": "bobama",
"updated": "Thu, 01 Jan 1970 00:00:00 UTC",
"lastname": "2",
"_id": "518ab5cfe584f144b095c4bf",
"created": "Thu, 01 Jan 1970 00:00:00 UTC",
"etag": "493ca13f6a2fbad1f11f321231aa8e0fab6bd0c0"
},
{
"firstname": "barack",
"_links": {
"self": {
"href": "127.0.0.1:5000/people/518ab5e0e584f144b095c4c0/",
"title": "person"
}
},
"username": "bobama",
"updated": "Thu, 01 Jan 1970 00:00:00 UTC",
"lastname": "2",
"_id": "518ab5e0e584f144b095c4c0",
"created": "Thu, 01 Jan 1970 00:00:00 UTC",
"etag": "dbc132dc64baae2bf0b3ff8b12f1d9dcff6ec4dc"
},
{
"firstname": "barack",
"_links": {
"self": {
"href": "127.0.0.1:5000/people/518ab5e9e584f144b8bb5405/",
"title": "person"
}
},
"username": "bobama",
"updated": "Thu, 01 Jan 1970 00:00:00 UTC",
"lastname": "2",
"_id": "518ab5e9e584f144b8bb5405",
"created": "Thu, 01 Jan 1970 00:00:00 UTC",
"etag": "75e0c4b68bc65612ddb591a8dc612191efc44e88"
}

i.e. all 3 inserts have gone through despite failing validators.

@nicolaiarocci
Copy link
Member

Hello,

this is happening on the development branch, right? If so it'll soon get back to normal, as there's currently a WIP to support bulk inserts (bulk inserts are working already, but validation is ignored). The stable branch (master) should hopefully be immune to this behavior.

@nicolaiarocci
Copy link
Member

And it's fixed, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants