FANDOM


Livecode works well with CouchDB without any plugin. Remember that you can verify all on the admin panel at http://127.0.0.1:5984/_utils/

Let's see some examples:

Test connectionEdit

Try:

put URL "http://127.0.0.1:5984/"

You get:

{"couchdb":"Welcome","uuid":"c049bbaa8f32635820f367ec7e77e4b6","version":"1.5.0","vendor":{"version":"14.04","name":"Ubuntu"}}

Show all databasesEdit

Try:

put URL "http://127.0.0.1:5984/_all_dbs" 

You get:

["_replicator","_users"]

Database creationEdit

Try:

PUT empty into URL http://127.0.0.1:5984/mynewdatabase"

Document creationEdit

Try:

put "Mary" into temp[FirstName]
put "Gold" into temp[Surname]
put "noise" into temp[Likes][1]
put "animals" into temp[Likes][2]
put "chocolate" into temp[Likes][3]
put jsonExport(temp) into temp
PUT temp into url "http://127.0.0.1:5984/mynewdatabase/mynewdocument1"

Listing all documentsEdit

Try _all_docs parameter:

PUT  url "http://127.0.0.1:5984/mynewdatabase/_all_docs" 

You get:

{"total_rows":1,"offset":0,"rows":[
{"id":"mynewdocument1","key":"mynewdocument1","value":{"rev":"1-b044c45141a2acf86c2e812081b2ed56"}}
]}

Get a documentEdit

Try:

PUT  url "http://127.0.0.1:5984/mynewdatabase/mynewdocument1"

You get:

{"_id":"mynewdocument1","_rev":"1-b044c45141a2acf86c2e812081b2ed56","FirstName":"Mary","Surname":"Gold","Likes":{"3":"chocolate","1":"noise","2":"animals"}}

Delete a documentEdit

Try:

delete URL "http://127.0.0.1:5984/mynewdatabase/mynewdocument1"

User and passwordEdit

If you need to authenticate with user and password just put them in your request:

put URL "http://user:password@127.0.0.1:5984/mydatabase"

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.