Page 3 of 3

Re: CouchDB Library

Posted: Mon Nov 09, 2020 8:28 am
by FourthWorld
I like to think of document stores as persistent arrays. They have the same name-value simplicity, but accessed from disk and so not limited to memory. But unlike arrays, they include options for querying, and automatically saving dynamically-updated query results in the form of "materialized views". And the better ones like CouchDB include powerful extras for replication across clusters if you need it (I don't, but it would be a good problem to have).

Re: CouchDB Library

Posted: Mon Nov 09, 2020 5:04 pm
by pink
I will see what I can dig up in terms of a demo app

the data will ultimately arrive as an array with the documents you've accessed

in terms of populating fields etc... it wouldn't be much different than you would with any data source, which is to say you would need to write out that code e.g.:

put tResultsArray["record101"]["first name"] into field "firstName"
put tResultsArray["record101"]["last name"] into field "lastName"

once you get used to Mango (based on the MongoDB query system) searching documents is pretty easy, for example:

Code: Select all

put 19700101 into tQuery["selector"]["$and"][1]["$gte"]["birthdate"]
put 19901231 into tQuery["selector"]["$and"][1]["$lte"]["birthdate"]
put "name" into tQuery["fields"][1]
put "email" into tQuery["fields"][2]
put couch.post("find",theURL,theDBname,tQuery) into tResults
-- this would produce an array of names and emails of anyone born between 1970 and 1990

stam wrote:
Sun Nov 08, 2020 7:02 pm
Thanks @pink,

Daybed library for couchDB looks very interesting... but my mindset is so SQL focused i keep thinking in terms of SQL approach which is probably not optimal for couchDB.
Is anyone able to share an actual working stack with CRUD operations in action, populating list boxes, related fields, updating etc with couchDB? (sorry, i know i shouldn't say 'related'). Reading the API kinda makes sense but i keep thinking in terms of relational databases...

Would be really great if someone could share a stack where either couchDB and/or Daybed were used 'in real life'

Re: CouchDB Library

Posted: Mon Nov 09, 2020 5:06 pm
by pink
By the way, over the last couple of weeks I've made a number of updates to the library, especially related to improving/optimizing the sync functions

Re: CouchDB Library

Posted: Mon Nov 09, 2020 6:32 pm
by FourthWorld
pink wrote:
Mon Nov 09, 2020 5:06 pm
By the way, over the last couple of weeks I've made a number of updates to the library, especially related to improving/optimizing the sync functions
Very valuable stuff - thank you!

Re: CouchDB Library

Posted: Tue Nov 10, 2020 1:06 am
by stam
Thanks Greg, that's really appreciated!

CouchDB - Where to start?

Posted: Sat Jan 02, 2021 7:26 pm
by stoltenberg
Hi there

and sorry, if I'm ending up in the wrong category – I should definitely stick to the newbie corner, but on the other hand
my question is absolute CouchDB-related. I've read the posts, watched the YouTube video, purchased the udemy course,
downloaded the "CouchDB library" and I'm still don't able to get it to work.

CouchDB and LiveCode are running smoothly, but i'm failing just on installing the "library". There is no documentation?
In the meantime I stumbled across multiple different hints and docs, but I can't imagine that it's so hard to use a library?
(The extension builder does'nt work and crashes LiveCode at the end.)

I#m completely lost :-(

Thank you in advance
Jan

Re: CouchDB - Where to start?

Posted: Tue Sep 21, 2021 3:29 pm
by pink
Sorry, I did not get a notification of this post and I'm sure this is waaaaaay too late.

You need to put the library into the message path somehow, for example:

- paste the library into the stack script, this would be the simplest approach
- make a substack with the library and access it with the "start using" command

Code: Select all

start using stack "couchdblib"
- put the library into any object and use the "insert script" command

Code: Select all

insert the script of button "couchdblib" into back
stoltenberg wrote:
Sat Jan 02, 2021 7:26 pm
Hi there

and sorry, if I'm ending up in the wrong category – I should definitely stick to the newbie corner, but on the other hand
my question is absolute CouchDB-related. I've read the posts, watched the YouTube video, purchased the udemy course,
downloaded the "CouchDB library" and I'm still don't able to get it to work.

CouchDB and LiveCode are running smoothly, but i'm failing just on installing the "library". There is no documentation?
In the meantime I stumbled across multiple different hints and docs, but I can't imagine that it's so hard to use a library?
(The extension builder does'nt work and crashes LiveCode at the end.)

I#m completely lost :-(

Thank you in advance
Jan

Re: CouchDB Library

Posted: Sat Nov 19, 2022 7:32 pm
by stoltenberg
(… never to late, as i'm stating with my latency ;-) Thanks a lot for your support!)