Hi Andres,
For your historical data; do you need to run all the same levels of
queries on it? Or would you be more likely to only need the historical
data so that you can undo changes?
For the latter case, consider if storing a copy of the previous versions
of a document as a json attachment
There is additionally several PHP couch libraries.
I use and would recommend you try https://github.com/dready92/PHP-on-Couch/
There's no sense in reinventing the wheel again and again...
On 18/09/2011 5:29 PM, Jens Alfke wrote:
Looks like you're rolling your own HTTP library, which is a bit wo
Alternatively, how about you page through _all_docs?
1. Query http://server:5984/dbname/_all_docs?limit=100
2. Process that set. Store the id of the last document.
3. Query
http://server:5984/dbname/_all_docs?limit=100&startkey=(last_id)&skip=1
to get the next set.
4. Repeat 2 and 3 until t
Node without installing lampp? I guess I
could just steal the logic.
On Tue, Jul 5, 2011 at 5:00 PM, Patrick Barnes wrote:
I have written a PHP script for my application to do this seamless update:
https://gist.github.com/1066246
I find it very useful! My rebuild time is about 30 minutes, so if
I use ISO8601 as well; "2010-08-29T13:07:49+10:00"
(generated using PHP date('c');)
On 6/07/2011 9:49 AM, Rudi Benkovič wrote:
Hi,
I'm writing a little CouchDB administration utility and would like to
find out how most of you store data values in JSON. From .NET via
Newtonsoft's JSON serializer
I have written a PHP script for my application to do this seamless update:
https://gist.github.com/1066246
I find it very useful! My rebuild time is about 30 minutes, so if it
blocked I'd have users screaming at me in short order.
One or two aspects of the script are app-specific, but it should
On 4/07/2011 1:11 PM, Matthew John wrote:
Hi all,
I am a newbie at CouchDB. I had a few queries back in my mind and thought I
would shoot them here:
1) I am familiar with MySql systems. In one of the applications I ve made,
whenever the server gets restarted I used to perform a warm up (similar
It might be possible to work around this, depending on how typically
out-of-order the documents are;
Have the reduce object be initially:
{
result: "",
version: 0,
unapplied_deltas: [] //(a sorted list)
}
where each element of unapplied_deltas is:
{
from:M,
to:N,
delta:"..."
}
I would *really* like to have functionality like this...
Perhaps a mechanism to manage serial snapshots of the db's state?
It seems to me be that maybe a snapshot could just be a header that does
not get compacted away, and that one could:
- 'Roll-back' the database to a given snapshot. (Undo,
This apparently occurs because if you upgrade over an existing
installation, some older .beam files remain and cause conflicts.
Move the (install path)/lib/couchdb folder somewhere else, run 'make
install' again, and see if the tests work.
Worked for me,
-Patrick
On 13/06/2011 11:03 PM, Dani
On path components, I wonder why an inline delimiter was chosen?
Would it be sensible to use an array instead?
Document:
{
"a": {
"a1":"foo",
"a2":"foo2"
},
"b": "notappearinginthisfilm"
"c": [0,1,2,4,5]
}
Patch:
[
{ "replace": ["a","a2"], "value":"bar2" },
{ "remove": ["b"]
over the top of an existing CouchDB
> installation? If so, you have mingled two conflicting versions of our
> modules together, which is going to cause function_clause errors all
> over the place.
>
> B.
>
> On 8 June 2011 03:46, Patrick Barnes wrote:
>> Having just updated
Having just updated to 1.1.0, I think I've been caught by the one
breaking change listed;
* Document id's are now validated during PUT. This means that some PUT
requests will fail that previously succeeded.
The user object I'm trying to store is:
|{
||"|_id|": |"org.couchdb.user:test_appdata_
Try typing 'js' from the server shell - it'll have been installed with
couchdb, if it wasn't there already. It gives you an interactive js
interpreter. Then, you can paste in your function; var map = function
(doc) { } and it may tell you where the syntax error lies.
Alternatively if you
On 23/05/2011 6:08 PM, He Shiming wrote:
@Patrick. The number of combination isn't that scary, given tags are sorted.
For a 2-tag query, 2-tag documents will have 1 combination only, and 3
for 3-tag docs. 45 combinations for 10-tag docs.
How do you get 45? '10 choose 3' is 120.
Also, you don'
With your original idea; to emit for each combination of tags... you may
still end up with an unworkable number of records in your view.
Say for each document you emit combinations of tags, in alphabetical
order. Limiting the maximum number of matched tags to 3, for example,
will help limit th
calhost:5984/db/ \
-H "Content-Type: application/json" -d '{"keys":["couchdb","python"]}'
Hope that helps,
-Patrick Barnes
On 22/05/2011 4:59 PM, He Shiming wrote:
Dear Community,
I'm working with documents like this:
{
"tags": [&
g those, only adding two extra attributes to
the new object created. (Not having to _copy_ every element should also
make this approach much faster than using a generic 'clone' method)
Hope that works. :-)
-Patrick
On 21/04/2011 1:00 AM, Hay (Husky) wrote:
On Wed, Apr 20, 2011 at 4:
Actually, he is...
if doc.events is an object, then the object might not actually be
copied, but only a reference.
If you change
var events = doc.events;
to
var events = clone doc.event;
Does that fix it?
On 20/04/2011 10:59 PM, Jan Lehnardt wrote:
On 20 Apr 2011, at 14:11, Nils Breunese w
For searching for an arbitrary set of conditions on fields, you will
want to use a search component like couchdb-lucene.
It's not just useful for full-text search; if you have a bunch of
parameters that you want to filter on, your lucene view can look like:
function(doc) {
var ret = n
anks
andrew
On 30/03/2011, at 2:13 PM, Patrick Barnes wrote:
You can do that with a single view:
In the map, emit for each field key [fieldname,fieldvalue] and value null.
In the reduce, set it to '_count' (instead of a js function) to use the
fast built-in reduce.
Then you can query
You can do that with a single view:
In the map, emit for each field key [fieldname,fieldvalue] and value null.
In the reduce, set it to '_count' (instead of a js function) to use the
fast built-in reduce.
Then you can query that view with
startkey=[fieldname]&endkey=[fieldname,{}]&group=true
le.
* To get the keys to the user's client, you could store them in
encrypted form within the user document, with the password as key. (That
way if the password changes, you only have to re-encrypt one document.)
-Patrick
B.
On 29 March 2011 00:41, Patrick Barnes wrote:
On 29/03/2011 2:
On 29/03/2011 2:38 AM, Nebu Pookins wrote:
If you have some secure data floating around in your db, encryption can
> still be a good idea. Parts of one of my databases are encrypted, because
> users need to be able to see some documents in the db but not others.
I'm curious as how you've imple
asant again.
I'll probably end up going with solution (2) because the proposed app
we're building will have to deal with banking and financial data, so
we're going to have to have some cryptography in there anyway, but I'm
just making sure I'm not missing anything (such as C
You're quite right, it would fail on replication. (And if you identified
that issue solely from a hypothetical standpoint, well done)
The solution could be to give your replication user as 'replication'
role, and have the validator function look something like:
function(newDoc, oldDoc, userCt
Hi Martin,
There is an example in php here:
https://github.com/dready92/PHP-on-Couch/blob/master/lib/couchAdmin.php#L163
On 23/03/2011 2:33 PM, Martin Hewitt wrote:
Hi all,
I'm writing a build process in Phing, part of which involves creating a new
CouchDB user. I'm having trouble logging in
I suggest using couchapp to store your field meta-info (validation,
format, etc) in a config/ folder or file, then you can:
a) Include it into your validate_doc_update.js file like:
function (newDoc, oldDoc, userCtx) {
// !json config.form
b) Refer to it from elsewhere like:
(PHP, because that
Perhaps you need a process to resolve conflicts?
On 4/03/2011 12:19 PM, Mark Hahn wrote:
I have a situation where I only want to know the latest version of a
doc and I don't care about any older versions. I don't care about
conflicts.
As far as I can tell there is no way to ignore conflicts in
I have been getting this error when I try to replicate databases:
Replication failed: {bad_term,{couch_rep_reader,'-open_doc_revs/3-fun-1-',
[{[{<<"error">>,<<"unauthorized">>},
{<<"reason">>,
<<"You are no
Tristan, if you are looking to run more complex queries (particularly
anything to do with wildcards) you should really look at couchdb-lucene.
http://github.com/rnewson/couchdb-lucene
-Patrick
On 17/01/2011 1:01 PM, Tristan Sloughter wrote:
I'm looking to query my Couch database in such a way
Hi Jeff,
On 23/11/2010 5:10 PM, Jeff Gorder wrote:
I have a case where there is a main public database that serves my application
and then will need to have a private database for each user. I've gotten this
to work manually and automatically when logged in as a server admin.
I understand tha
13/10/2010 1:32 PM, Paul Davis wrote:
On Tue, Oct 12, 2010 at 10:25 PM, Patrick Barnes wrote:
While you're refactoring, can I suggest - for each view, store a checksum of
the map/reduce functions?
At the moment, If something unrelated (like the validation function, or a
version number) in
While you're refactoring, can I suggest - for each view, store a
checksum of the map/reduce functions?
At the moment, If something unrelated (like the validation function, or
a version number) in the design document is changed, it's rebuilding all
the views and it doesn't need to.
-Patrick
Yes it does, all views of a design doc update at once.
If you have some views that are not often needed, but are very expensive
to generate, it can be better to put them in another design doc.
On 10/10/2010 11:08 PM, mickael.bai...@free.fr wrote:
That's interesting. For my personnal curiosity:
Not exactly, as I understand it. I believe that couchdb guarantees that
after bi-directional replication, for any conflicted documents all dbs
will choose the same rev as the 'successful' one, with the other revs in
the _conflicted area.
I too, would love to have a means of automatically resol
assuming you've set require_valid_user=true?
If so, you need to add a user:pass value to couchdb-lucene's ini file.
The details are in the README under "Security".
Sent from my iPad
On 24 Sep 2010, at 07:53, Patrick Barnes wrote:
I have couchdb-lucene set up and working fine - I can
I have couchdb-lucene set up and working fine - I can query the fulltext
view I have defined. (Using couchdb-lucene 0.5.6 and couchdb 1.0.1)
However, if I set any readers in the database's security options and
call with *proper* credentials, couchdb-lucene fails, with response:
{"code":500,
"
Can you be more specific? What do you mean by a 'req argument'?
From a view you can fetch all values with a single key, a number of
keys, or a contiguous range of keys specified by startkey/endkey.
On 18/09/2010 3:41 PM, Tyler Gillies wrote:
On Fri, Sep 17, 2010 at 10:32 PM, Tyler Gillies w
The basic tenets of views are:
1. Map/reduce functions must be idempotent, and look only at the
document/data passed to it.
2. Emitted keys get sorted onto a single axis, and with view queries you
can retrieve a single given key, multiple given keys, or a contiguous
subset of keys with a given
building feature. :)
B.
On Thu, Aug 26, 2010 at 2:40 PM, Patrick Barnes wrote:
I have a database serving documents through a number of intermediary
application servers, to the users' web browsers.
There are two mechanisms by which documents are modified;
a) Piecemeal updates as a result of use
Stale=ok is a simple solution to the bulk problem, but the application
servers will also expect to be able to update documents, and retrieve
the changes immediately after.
Is there a good way to avoid these large view update delays?
-Patrick Barnes
PM, Nils Breunese wrote:
Patrick Barnes wrote:
For what its worth, I have found JSONView to be a useful Firefox extension -
it adds accepts:application/json to the request headers, and any json
content is properly formatted and displayed in the window.
It's nice when working with CouchDB
For what its worth, I have found JSONView to be a useful Firefox extension -
it adds accepts:application/json to the request headers, and any json
content is properly formatted and displayed in the window.
-Patrick
On 04/07/2010 2:03 AM, "J Chris Anderson" wrote:
On Jul 3, 2010, at 7:45 AM, Pa
..(goes on for a
long time, includes the _user db validate_doc_update function text)
- Most of the tests don't work, including the 'basics' test - the status
changes to 'running', but the test never completes.
Happy to help with chasing these things up, but not sure where to start.
-Patrick Barnes
As Daniel Truemper said, couchdb-lucene is what you want for any kind of
partial matching capability. A couchdb-lucene query can also be crafted
to match A OR B.
If you only want a straight OR match, for instance "show me documents
where doc.author is '0102010' or '0102014'", then the simplest
On 15/06/2010 2:33 PM, Lowry, Matthew wrote:
Reading between the lines, I get the impression that the answer to my
question is "No - the view API does not support fetching keys without
values." This is a pity. And strangely inconsistent with the document
API, in my opinion. The document API allow
The document API is a view as well, where the value emitted for each doc
is null.
You say that each of the rows in your view has a large value object, but
that you don't need it? Then why are you emitting it in the first place?
If you have two different use cases;
a) Fetching lots of keys
b)
Another solution is to use couchapp - 'couchapp push' on an existing
database will only update the design doc. As part of the upgrade process,
you can just run push for each database. This would be simple in an upgrade
script - it could even load the list of databases out of couchdb first.
-Patri
Steven:
Also, from source, couchdb will install by default to /usr/local/couchdb.
If you wish to override the 0.8.0 version and install it at top-level,
you may need to re-run the source installation steps, using:
./configure --prefix=/ --exec-prefix=/
Remember of course to restart couchdb.
n't need their own db.
There's no "literature" for it yet, or even much documentation - but I'd be
happy to discuss it with you further if you're interested. I'd love to know
more about what you're planning, as well.
Patrick Barnes
Senior Software Engi
How do you currently organise the documents into a tree and display them?
For my trees, I have a 'hierarchy' array attribute that basically holds
a tree address, eg:
A = {"_id":"A", "hierarchy":["A"]};
B = {"_id":"B", "hierarchy":["B"]};
C = {"_id":"C", "hierarchy":["B","C"]};
D
I recently upgraded my couchdb server, and I can't run the test suite;
there are existing databases and users defined.
Is there a better way to test that the database server is working
properly other than having to delete all the administrators and manually
restore them later?
-Patrick
That does seem to be the way to go about implementing such a system. I
will see how I go, and will publish the results if I end up with
something that seems reusable.
-Patrick
On 19/04/2010 6:00 PM, Thomas Nunninger wrote:
Hi,
Am Montag, 19. April 2010 09:44:22 schrieb Patrick Barnes
Partly - I was wondering also if there was something similar to the
functionality phpunit has for initialising database contents from XML
files, etc.
On 19/04/2010 5:15 PM, David Coallier wrote:
On 19 April 2010 07:16, Patrick Barnes wrote:
Has anyone on the list (or elsewhere) written code
Has anyone on the list (or elsewhere) written code for phpunit to make
setting up /tearing down couchdb test databases for unit testing easier?
Cheers,
-Patrick
Try running 'js' from the console - it's an interactive javascript
interpreter that makes figuring these things out much easier.
Try:
function(doc) {
doc.hash = md5(doc.passwd);
emit(null, doc);
}
On 13/04/2010 3:42 PM, Cesar Delgado wrote:
I'm playing around with CouchDB and a
To nitpick slightly - you won't get a value of zero, you'll just find that
there is no entry for the given key. ;-)
-Patrick
On 30/03/2010 3:06 AM, "Daniel Itaboraí" wrote:
Distributed uniqueness is a hard problem, but since you intend to use it
only on a single node, perhaps you should create
#x27;m not sure if that would cause further issues regarding whether to
invalidate content changes made by X, or how best to resolve that sort
of thing.
On 29/03/2010 12:58 PM, Robert Sanford wrote:
On Sun, Mar 28, 2010 at 7:20 PM, Patrick Barnes wrote:
For the single-document situation: W
Hi Ben, I don't have all the answers for you, but a few tips...
On posts and comments - It is important to think in terms of concurrency
- a person will write and submit a post once, and people will reply in
comments many times.
For the single-document situation: What if multiple people reply
Luis - if you emit them as numbers rather than strings, they will sort in
the proper order.
>From memory, I think one of the string methods is used to convert string to
int.
Alternatively, consider storing those properties as numbers in the first
place - not only will your keys sort properly, but
Is there any reason you are storing your numeric values as strings in
the first place? (In JSON notation 11234 and "11234" are a number and a
string, respectively)
If you were emitting numbers for that part of the key array, then it
would sort the way that you're after.
On 12/03/2010 11:16 A
To confirm...
You *are* using couchapp to generate your design doc, keeping the view and
show funcs in files, and the included files in the same couchapp area?
-Patrick
On 28/02/2010 6:57 AM, "Clemens Cap" wrote:
I am having a problem to understand the path where the engine looks for
the files
Hi Barry,
There are three ways to select data out of a view...
A specific key: ?key=["foo"]
A number of specific keys: keys=[["foo"], ["bar"], ["baz"]] (Which is
passed in as user data on a POST request.
A contiguous region of keys, delimited by startkey and endkey.
If you have a view where
#x27;ve rewritten my map functions to clone the array to a local
var before I call path.pop().
-Patrick Barnes
before), so it
might just be my server, but this behaviour seems either odd or incomplete.
Thoughts?
(Also, can 'sign up' be disabled / admin users allowed to create new users?)
-Patrick Barnes
Read through the documentation at
http://github.com/rnewson/couchdb-lucene
(Keep scrolling further down the page)
When you call rec.add() (And you can call add() more than once per
function), there is an optional second argument to set the indexing options:
The two that you'd probably find use
Hi madhav,
Typically, you create a view where the key is the data you want to
filter on, and the value is the data you want to retrieve.
eg: If you have a big db of people, and you want to be able to look up
people by their phone number, and will want to display at least their names:
map =
Couchdb does not do fulltext searching itself. (eg for a website's search
function)
For search, the generally accepted 'best' solution is couchdb-lucene - it
plugs into couchdb to give you all those nifty matching features.
-Patrick
On 02/02/2010 9:25 PM, "Jo Giraerts" wrote:
Hi,
I'm just sta
Have you looked at / tried couchapp?
I'm using it for my development - it allows me to use proper version control
on what goes into the design docs.
-Patrick
On 02/02/2010 10:22 AM, "Phil Rand" wrote:
Hi all,
I've been playing around with couchdb for a while, but am getting frustrated
with Fut
n if
feasible, that would only work using one key at a time. *yawns*
But the grouped query makes sense, I'll test it tomorrow.
-P
On 1/02/2010 10:04 PM, Brian Candler wrote:
On Mon, Feb 01, 2010 at 05:43:29PM +1100, Patrick Barnes wrote:
It looks messy if the node has a little 'expand&
}
}
So things mostly work nicely - I can click on a node, and it will
dynamically load children, rinse, repeat.
It looks messy if the node has a little 'expand' icon next to it, though
- but there are no actual children below it. Is it possible to create a
view that will emit as value whether each node has children?
Cheers,
-Patrick Barnes
I have run into similar problems.before... in your logs I can see a bunch of
references to 'gcj'.
I suggest you install the Sun Java JDK and make sure maven is using
it...That should hopefully fix your issue.
The incompatibility doesn't appear to be in couchdb-lucene, but in the maven
testing fra
Perhaps if you have a document set small enough to retrieve by explicit
keys, you can just sort by date on the client?
-Patrick
On 24/12/2009 9:17 PM, "Borja Martín" wrote:
Hi,
thanks for your answer. The thing is that this solution only works for
single keys and I can't use the startkey/endkey
ry (any query) just like the same rule for trigger view building.
I should note that both versions take ?stale=ok will not block for
updates, returning search results based on what's currently indexed.
On Tue, Dec 22, 2009 at 6:52 AM, Patrick Barnes wrote: >
Hi, > > I want to use ...
Hi,
I want to use couchdb-lucene to search approx 350k records - is there a
way to have it build the indexes before starting a search?
I don't seem to be able to get results. So far, I've gotten:
* couchdb-lucene built and installed
* bin/run running (as root for now)
* couchdb configured to
http://wiki.apache.org/couchdb/How_to_intercept_document_updates_and_perform_additional_server-side_processing
It's a fairly new feature, and isn't covered properly by the book yet.
Don't worry, I saw a post claiming that validate_doc_update could modify
the newDoc var (it can't), and wrote a fa
n Tue, 2009-12-01 at 22:39 +1100, Patrick Barnes wrote:
Hi Markus,
When you get a 500 error, it is typically because one of your javascript
functions has had a run-time error.
In your error log, see: "JavaScript function raised error: TypeError:
doc is null"
You can't assume
Hi Markus,
When you get a 500 error, it is typically because one of your javascript
functions has had a run-time error.
In your error log, see: "JavaScript function raised error: TypeError:
doc is null"
You can't assume that doc is always a document - As the book states in a
following para
Thanks, will implement something like that.
-Patrick
On 25/11/2009 7:46 PM, "Brian Candler" wrote:
On Mon, Nov 23, 2009 at 01:10:26PM +1100, Patrick Barnes wrote: > The
external data is delivered as ...
Sounds like you need a merge. Taking users as an example:
- have a couch
lve this? Perhaps I really think way to complex, or
there's something wrong with the view logic I am thinking of.
Greetings,
Lennart
On Nov 18, 2009, at 12:23 PM, Patrick Barnes wrote:
I would suggest that each comment has a 'hierarchy' attribute, like an OID...
For instance: (
and roles. (Whether roles
should be stored in the user document or separately, I'm not yet sure)
Given that there are ~200k users, ~150k roles, and ~3k groups, how would
you suggest this update process be approached?
Regards,
-Patrick Barnes
e_doc_update
to check that the user and group the role refers to exist? I don't want
orphan roles to be able to be created.
(Alternatively: Is there a better way to do this?)
-Patrick Barnes
I would suggest that each comment has a 'hierarchy' attribute, like an
OID...
For instance: ('.'s for padding)
[
{"hierarchy":[1], "id":1, "data":"foo"}
...{"hierarchy":[1,2], "id":2, "data":"foo"}
...{"hierarchy":[1,3], "id":3, "data":"foo"}
..{"hierarchy":[1,3,5], "id":5, "data":"foo"}
84 matches
Mail list logo