Re: purging documents?

2012-05-20 Thread Paul Davis
Yeah, likely the best way to undo this would be to use filtered
replication to a local db and then rename the .couch files and reboot
to get it swapped over.

On Fri, May 18, 2012 at 1:02 PM, Jim Klo  wrote:
> Not sure how many docs you have, but can you filter replicate the good docs
> into a new db?
>
>
> Jim Klo
> Senior Software Engineer
> Center for Software Engineering
> SRI International
>
> On May 18, 2012, at 10:39 AM, Tim Tisdall wrote:
>
> After further reading it seems like I could use _purge ...  However, I
> still need to query the DB to fetch all the revisions.
>
> On Fri, May 18, 2012 at 12:12 PM, Tim Tisdall  wrote:
>
> I accidentally created several million documents in my DB which I'd like
>
> to undo.  ^_^  I know I can query each document to get the revision and
>
> then issue a DELETE, but that seems like a lot of additional work.  Also,
>
> the wiki says "Deleted documents remain in the database forever, even after
>
> compaction, to allow eventual consistency when replicating." and that's a
>
> lot of dead space.  Is there a way that I can purge all of those documents
>
> given that I have the _ids that they were saved under?  I essentially would
>
> like to return the DB to a state before I inserted all of those documents.
>
>
> I'm also going to be inserting updated documents to the DB with those same
>
> _ids, so another alternative is to post updates to each (but that would
>
> also require getting the revision ids) and then clearing out old revisions.
>
> However, this would require fetching several million revision ids and then
>
> figuring out how to force the DB to clear out all old revisions.
>
>
> -Tim
>
>
>


Re: manipulating .couch files

2012-05-20 Thread Paul Davis
On Thu, May 17, 2012 at 1:58 PM, Tim Tisdall  wrote:
> I want to temporarily open the port for couchdb so I can access futon.
>  However, I have a large database already in there that I don't want
> accessible by the public.  If I temporarily move the database_name.couch
> file from the var/lib/couchdb/ directory and then move it back after allow
> me to hide the database?  I just want to make sure that I'm not missing
> something such that copying it back will result in it no longer working.
>
> -Tim

Just to be thorough, yes and no. You could definitely move the file
out of the way and move it back no problem. The only thing to note
here is that if you move it while couchdb has the file opened it'll
maintain that link and still have access. The easiest way to make sure
its not connected is to just reboot the server.


Re: Hierarchical comments Hacker News style

2012-05-20 Thread Jim Klo
If you're trying to sort hierarchically using integers as id's, assuming the 
id's grow incrementally with time (say you were using local_seq), the arrays 
will naturally sort numerically, whereas strings are going to sort 
alphanumerically,  meaning 2, 3, 22, 33 vs "2", "22", "3","33".

Hence,

[ 1, 2 ]
[ 1, 3 ]
[ 1, 3, 10 ]
[ 1, 22 ]
[ 1, 22, 4 ]
[ 1, 22, 5 ]

Which is what I think your intended sort order?



Sent from my iPad

On May 20, 2012, at 5:15 PM, "Keith Gable"  wrote:

>>> I'm not sure I'm following the whole thread, but why are you storing 
>>> integers as strings?
>>> 
>>> If you store them as numbers, they would collate right I think.
>> 
>> Hi Jim,
>> 
>> Can you provide an example?
> 
> I merely provided an example of using integers as integers.
> 
> ---
> Keith Gable
> A+ Certified Professional
> Network+ Certified Professional
> Storage+ Certified Professional
> Mobile Application Developer / Web Developer
> 
> 
> On Sun, May 20, 2012 at 11:25 AM, Luca Matteis  wrote:
>> On Sun, May 20, 2012 at 4:10 PM, Keith Gable  
>> wrote:
>>> Integers as strings:
>>> 
>>> ["1", "2", "3"]
>>> 
>>> Integers as integers:
>>> 
>>> [1, 2, 3]
>> 
>> Okay, but how does that help with the question at hand?


smime.p7s
Description: S/MIME cryptographic signature


Re: Hierarchical comments Hacker News style

2012-05-20 Thread Keith Gable
>> I'm not sure I'm following the whole thread, but why are you storing 
>> integers as strings?
>>
>> If you store them as numbers, they would collate right I think.
>
>Hi Jim,
>
>Can you provide an example?

I merely provided an example of using integers as integers.

---
Keith Gable
A+ Certified Professional
Network+ Certified Professional
Storage+ Certified Professional
Mobile Application Developer / Web Developer


On Sun, May 20, 2012 at 11:25 AM, Luca Matteis  wrote:
> On Sun, May 20, 2012 at 4:10 PM, Keith Gable  
> wrote:
>> Integers as strings:
>>
>> ["1", "2", "3"]
>>
>> Integers as integers:
>>
>> [1, 2, 3]
>
> Okay, but how does that help with the question at hand?


Re: Review of CouchDB 1.2.0

2012-05-20 Thread Miles Pomeroy
Thanks. I don't call it out explicitly, but I link to the Jira item in
my second footnote.

On Sun, May 20, 2012 at 3:48 PM, Robert Newson  wrote:
> Very nice! But perhaps you could note that 1.3 will switch from the
> simple SHA1 scheme to PBKDF2 with configurable work factor?
>
> B.
>
> On 20 May 2012 21:27, Miles Pomeroy  wrote:
>> I wrote a post about the new features in 1.2.0. Check it out and let
>> me know if there are any inaccuracies.
>>
>> http://nonsensequel.com/posts/couchdb-1-2-0/
>>
>> Miles.


Re: Review of CouchDB 1.2.0

2012-05-20 Thread Robert Newson
Very nice! But perhaps you could note that 1.3 will switch from the
simple SHA1 scheme to PBKDF2 with configurable work factor?

B.

On 20 May 2012 21:27, Miles Pomeroy  wrote:
> I wrote a post about the new features in 1.2.0. Check it out and let
> me know if there are any inaccuracies.
>
> http://nonsensequel.com/posts/couchdb-1-2-0/
>
> Miles.


Re: Hierarchical comments Hacker News style

2012-05-20 Thread Luca Matteis
On Sun, May 20, 2012 at 4:10 PM, Keith Gable  wrote:
> Integers as strings:
>
> ["1", "2", "3"]
>
> Integers as integers:
>
> [1, 2, 3]

Okay, but how does that help with the question at hand?


Re: Hierarchical comments Hacker News style

2012-05-20 Thread Keith Gable
Integers as strings:

["1", "2", "3"]

Integers as integers:

[1, 2, 3]
On May 20, 2012 3:37 AM, "Luca Matteis"  wrote:

> On Sun, May 20, 2012 at 6:08 AM, Jim Klo  wrote:
> > I'm not sure I'm following the whole thread, but why are you storing
> integers as strings?
> >
> > If you store them as numbers, they would collate right I think.
>
> Hi Jim,
>
> Can you provide an example?
>


Re: Why is the _id called id in the response from a put request?

2012-05-20 Thread Goog Cheng

On 05/20/2012 08:26 PM, Alexander Gabriel wrote:

@Martin: Thanks, understanding it will hopefully help me remember.

@Goog:saveDoc() is a function included in jquery.couch.js.
You can use it whenever you reference jquery.couch.js.
To reference it I have this line in the header of the document:

where you have to replace js/ with your own path to where
jquery.couch.js is in your project.
Hope I got your question right.

Alex



On Sun, May 20, 2012 at 1:13 PM, Martin Higham  wrote:


_id and _rev are field names within a document, whereas the non-underscore
versions are copies of those values.

On 20 May 2012 11:35, Goog Cheng  wrote:


On 05/20/2012 06:16 PM, Alexander Gabriel wrote:


I am using jquery.couch.js.
In a openDoc() the return key for the _id is named "_id".
In a saveDoc() the return key for the _id is named "id".
Looking in Firebug at the get and put requests that are beeing sent the
reason seems to be the answer of couchdb to a put
request: {"ok":true,"id":"**181aa4dc7fd13af83aee8af9090067**
5c","rev":"43-**69c0afda410423339da0caf97dc9c9**94"}
This difference in naming does not seem to be a very relaxing feature

and

it id the cause of a whole bunch of errors in my app.
Is there a reason why couchdb calls its DocId sometimes "_id" and other
times "id"?
Knowing this reason might help me prevent future errors...
Alex

  yes, saveDoc is the id ,can saveDoc() function be used out of a

couchapp  (in a common html ) ?


@Alex  thank you!


Re: Why is the _id called id in the response from a put request?

2012-05-20 Thread Alexander Gabriel
@Martin: Thanks, understanding it will hopefully help me remember.

@Goog:saveDoc() is a function included in jquery.couch.js.
You can use it whenever you reference jquery.couch.js.
To reference it I have this line in the header of the document:

where you have to replace js/ with your own path to where
jquery.couch.js is in your project.
Hope I got your question right.

Alex



On Sun, May 20, 2012 at 1:13 PM, Martin Higham  wrote:

> _id and _rev are field names within a document, whereas the non-underscore
> versions are copies of those values.
>
> On 20 May 2012 11:35, Goog Cheng  wrote:
>
> > On 05/20/2012 06:16 PM, Alexander Gabriel wrote:
> >
> >> I am using jquery.couch.js.
> >> In a openDoc() the return key for the _id is named "_id".
> >> In a saveDoc() the return key for the _id is named "id".
> >> Looking in Firebug at the get and put requests that are beeing sent the
> >> reason seems to be the answer of couchdb to a put
> >> request: {"ok":true,"id":"**181aa4dc7fd13af83aee8af9090067**
> >> 5c","rev":"43-**69c0afda410423339da0caf97dc9c9**94"}
> >> This difference in naming does not seem to be a very relaxing feature
> and
> >> it id the cause of a whole bunch of errors in my app.
> >> Is there a reason why couchdb calls its DocId sometimes "_id" and other
> >> times "id"?
> >> Knowing this reason might help me prevent future errors...
> >> Alex
> >>
> >>  yes, saveDoc is the id ,can saveDoc() function be used out of a
> > couchapp  (in a common html ) ?
> >
>


Re: Why is the _id called id in the response from a put request?

2012-05-20 Thread Martin Higham
_id and _rev are field names within a document, whereas the non-underscore
versions are copies of those values.

On 20 May 2012 11:35, Goog Cheng  wrote:

> On 05/20/2012 06:16 PM, Alexander Gabriel wrote:
>
>> I am using jquery.couch.js.
>> In a openDoc() the return key for the _id is named "_id".
>> In a saveDoc() the return key for the _id is named "id".
>> Looking in Firebug at the get and put requests that are beeing sent the
>> reason seems to be the answer of couchdb to a put
>> request: {"ok":true,"id":"**181aa4dc7fd13af83aee8af9090067**
>> 5c","rev":"43-**69c0afda410423339da0caf97dc9c9**94"}
>> This difference in naming does not seem to be a very relaxing feature and
>> it id the cause of a whole bunch of errors in my app.
>> Is there a reason why couchdb calls its DocId sometimes "_id" and other
>> times "id"?
>> Knowing this reason might help me prevent future errors...
>> Alex
>>
>>  yes, saveDoc is the id ,can saveDoc() function be used out of a
> couchapp  (in a common html ) ?
>


Re: How does OAuth support, or custom headers, work in the replicator?

2012-05-20 Thread Martin Higham
Hi Jens,

- CouchDB supports OAuth 1.0, not 2.0

- The fields in the replication structure are fine if you want CouchDB to
replicate to CouchDB, but I think in your case you want to OAuth requests
from a client to CouchDB so you will want to sign each request yourself.

- We use the OAuthConsumer library to authenticate requests fromIOS to
CouchDB. Our fork (https://github.com/ocastastudios/oauthconsumer) has a
some bug fixes as the library creator doesn't seem to be maintaining it.

- The CouchDB wiki contains the details on configuring OAuth on the server (
http://wiki.apache.org/couchdb/Link_Collection_Authentication_and_Authorization
)

- CouchDB doesn't give you any way to get the tokens from the server to the
client so this has to be application specific.


Martin



On 19 May 2012 19:59, Jens Alfke  wrote:

>
> On May 18, 2012, at 6:05 PM, Adam Kocoloski wrote:
>
> > I had to read the code for this one.  It looks like e.g.
> source.auth.oauth would be a JSON object with "consumer_secret",
> "consumer_key", "token_secret", and "token" fields (and an optional
> "signature_method" field).  The Authorization header would be computed by
> the replicator for each request using this information.
>
> Does anyone here know more about OAuth? I'm implementing the MAC
> authorization scheme* that OAuth uses, but the parameters it takes don't
> seem to match up with what's listed above. The parameters I need to compute
> the Authorization header are {key,  key identifier, issue time}.
>
> (This is for the purpose of implementing OAuth support in TouchDB, by the
> way.)
>
> —Jens
>
> * http://tools.ietf.org/html/draft-ietf-oauth-v2-http-mac-00
>
>


Re: Why is the _id called id in the response from a put request?

2012-05-20 Thread Goog Cheng

On 05/20/2012 06:16 PM, Alexander Gabriel wrote:

I am using jquery.couch.js.
In a openDoc() the return key for the _id is named "_id".
In a saveDoc() the return key for the _id is named "id".
Looking in Firebug at the get and put requests that are beeing sent the
reason seems to be the answer of couchdb to a put
request: 
{"ok":true,"id":"181aa4dc7fd13af83aee8af90900675c","rev":"43-69c0afda410423339da0caf97dc9c994"}
This difference in naming does not seem to be a very relaxing feature and
it id the cause of a whole bunch of errors in my app.
Is there a reason why couchdb calls its DocId sometimes "_id" and other
times "id"?
Knowing this reason might help me prevent future errors...
Alex

yes, saveDoc is the id ,can saveDoc() function be used out of a 
couchapp  (in a common html ) ?


Why is the _id called id in the response from a put request?

2012-05-20 Thread Alexander Gabriel
I am using jquery.couch.js.
In a openDoc() the return key for the _id is named "_id".
In a saveDoc() the return key for the _id is named "id".
Looking in Firebug at the get and put requests that are beeing sent the
reason seems to be the answer of couchdb to a put
request: 
{"ok":true,"id":"181aa4dc7fd13af83aee8af90900675c","rev":"43-69c0afda410423339da0caf97dc9c994"}
This difference in naming does not seem to be a very relaxing feature and
it id the cause of a whole bunch of errors in my app.
Is there a reason why couchdb calls its DocId sometimes "_id" and other
times "id"?
Knowing this reason might help me prevent future errors...
Alex


Re: Hierarchical comments Hacker News style

2012-05-20 Thread Luca Matteis
On Sun, May 20, 2012 at 6:08 AM, Jim Klo  wrote:
> I'm not sure I'm following the whole thread, but why are you storing integers 
> as strings?
>
> If you store them as numbers, they would collate right I think.

Hi Jim,

Can you provide an example?