CouchDB Library

Creating desktop or client-server database solutions?

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller, robinmiller

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 8169
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
Community volunteer LiveCode Community Liaison

LiveCode development, training, and consulting services: Fourth World Systems: http://FourthWorld.com
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

pink
Posts: 256
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: 256
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: 8169
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
Community volunteer LiveCode Community Liaison

LiveCode development, training, and consulting services: Fourth World Systems: http://FourthWorld.com
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

stam
Posts: 167
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!

Post Reply

Return to “Databases”