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

Can't get an update to take on the users table. #40

Closed
jwdonley opened this issue Oct 7, 2012 · 5 comments
Closed

Can't get an update to take on the users table. #40

jwdonley opened this issue Oct 7, 2012 · 5 comments

Comments

@jwdonley
Copy link

jwdonley commented Oct 7, 2012

For some reason I cannot get an update to take on the users table in couch. Here's some code

CouchClient _client = CouchClientProvider.GetClient();
CouchDatabase _db = _client.GetDatabase("_users");
_db.SetDefaultDesignDoc("test_users");

Document<CouchUserDocument> doc = new Document<CouchUserDocument>(
  new CouchUserDocument()
    {
        name = user.Email,
        user_name = user.Name,
        testing_password = user.Password,
        datecreated = user.DateCreated,
        datemodified = user.DateModified,
        roles = user.Roles.Select(x => x.Name).ToList(),
        user_type = "testing",
        type = "user"
    });
doc.Id = "org.couchdb.user:" + user.Email;
 _db.SaveDocument(doc);

var result = _db.GetDocument<CouchUserDocument>(doc.Id);

I'm getting the doc back, but nothing is updating. I'm specifically trying to update the 'roles' property.
Any thoughts?

@soitgoes
Copy link
Owner

soitgoes commented Oct 7, 2012

I'm virtually certain that it's due to one of the validation rules that is
in place on the _users db. If I were you I would try and make the same
change in futon and see what it says. My bet is that it complains about
something.

Technically I would've thought that would've produced an different http
error code than 200 so there my be something I need to look into but let me
know please if that is the problem.

If it works when you try it in Futon then please try it on a tmp database
so that we can eliminate the database as the problem.

Hope this helps.

Thanks

-Martin

On Sun, Oct 7, 2012 at 4:47 PM, Joe Donley notifications@github.com wrote:

For some reason I cannot get an update to take on the users table in
couch. Here's some code

CouchClient _client = CouchClientProvider.GetClient();
CouchDatabase _db = _client.GetDatabase("_users");
_db.SetDefaultDesignDoc("test_users");

Document doc = new Document(
new CouchUserDocument()
{
name = user.Email,
user_name = user.Name,
testing_password = user.Password,
datecreated = user.DateCreated,
datemodified = user.DateModified,
roles = user.Roles.Select(x => x.Name).ToList(),
user_type = "testing",
type = "user"
});
doc.Id = "org.couchdb.user:" + user.Email;
_db.SaveDocument(doc);

var result = _db.GetDocument(doc.Id);

I'm getting the doc back, but nothing is updating. I'm specifically trying
to update the 'roles' property.
Any thoughts?


Reply to this email directly or view it on GitHubhttps://github.com//issues/40.

Martin Murphy
Whiteboard-IT
http://whiteboard-it.com
(205) 910-0720

@jwdonley
Copy link
Author

jwdonley commented Oct 7, 2012

Got the update to work just fine in Futon. I'm going to try it on another db right quick.

@jwdonley
Copy link
Author

jwdonley commented Oct 7, 2012

Taking the same steps but for a different database gives me the same results.

@soitgoes
Copy link
Owner

soitgoes commented Oct 7, 2012

Nothing is wrong with the code that I can see but if the id is already
existing you must submit it with a rev.
On Oct 7, 2012 5:10 PM, "Joe Donley" notifications@github.com wrote:

Taking the same steps but for a different database gives me the same
results.


Reply to this email directly or view it on GitHubhttps://github.com//issues/40#issuecomment-9213096.

@jwdonley
Copy link
Author

jwdonley commented Oct 7, 2012

Ah, that's probably it than. Thanks!

@jwdonley jwdonley closed this as completed Oct 7, 2012
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

No branches or pull requests

2 participants