CouchDB Library

Creating desktop or client-server database solutions?

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9801
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: CouchDB Library

Post by FourthWorld » Mon Nov 09, 2020 8:28 am

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).
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

pink
Posts: 272
Joined: Wed Mar 12, 2014 6:18 pm

Re: CouchDB Library

Post by pink » Mon Nov 09, 2020 5:04 pm

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'
Greg (pink) Miller

MadPink, LLC
I'm Mad, Pink and Dangerous to Know

pink
Posts: 272
Joined: Wed Mar 12, 2014 6:18 pm

Re: CouchDB Library

Post by pink » 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
Greg (pink) Miller

MadPink, LLC
I'm Mad, Pink and Dangerous to Know

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9801
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: CouchDB Library

Post by FourthWorld » Mon Nov 09, 2020 6:32 pm

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!
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

stam
Posts: 2599
Joined: Sun Jun 04, 2006 9:39 pm
Location: London, UK

Re: CouchDB Library

Post by stam » Tue Nov 10, 2020 1:06 am

Thanks Greg, that's really appreciated!

stoltenberg
Posts: 16
Joined: Tue Jun 19, 2018 8:50 am
Location: DK/DE
Contact:

CouchDB - Where to start?

Post by stoltenberg » 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

pink
Posts: 272
Joined: Wed Mar 12, 2014 6:18 pm

Re: CouchDB - Where to start?

Post by pink » Tue Sep 21, 2021 3:29 pm

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
Greg (pink) Miller

MadPink, LLC
I'm Mad, Pink and Dangerous to Know

stoltenberg
Posts: 16
Joined: Tue Jun 19, 2018 8:50 am
Location: DK/DE
Contact:

Re: CouchDB Library

Post by stoltenberg » Sat Nov 19, 2022 7:32 pm

(… never to late, as i'm stating with my latency ;-) Thanks a lot for your support!)

Post Reply

Return to “Databases”