php - Couchbase JSON structure model -
i want work couchbase json-document oriented. don't know what's best way store , structure data , retrieve later.
is there somehow tutorial started (the learing resources on couchbase.com did not help)?
i'm using php access couchbase. i've got following sample:
(new document) user1 { "uid":1, "name":"marius" } (new document) planet1 { "pid":1, "user_uid":1, "name":"earth" } (new document) user2 { "uid":2, "name":"anyone" } (new document) planet2 { "pid":2, "user_uid":2, "name":"saturn" } now smartest way set (insert) these documents database , how can (select) documents selection.
to in sql want -> select * user,planet user.uid=1 , planet.user_uid=1
couchbase stores data differently relational database.
there 2 main ways data out of couchbase:
key/value. means give document 1 key query on , value going entire document. user:
user = couch.get(123) that return entire document user id 123.
views. can write views in couchbase using map/reduce functions. cool thing these views can accessed in similar way views in couchdb, can things ordering , limiting. http://wiki.apache.org/couchdb/http_view_api#querying_options
check out design documents/views in couchbase portal. when write 1 it'll give url test map/reduce stuff. can add parameters url additional work.
Comments
Post a Comment