Hi Jens,
thank you for your quick respond. You’re right. My platform is Cordova and I’ve been using javascript and REST API (I’d forgotten add platform and others ).
I like the Couchbase’s logic. It offers effective solutions for different problems. I’ve been trying to learn how to use Couchbase with PhoneGap in a project. There are a lot of documentations. I’ve been reading for 2 weeks.
In fact thanks to you, I could watch and read lots of guides include doc.couchbase.com, developer.couchbase.com/mobile, forum.couchbase.com, your google forums and the following sources. In the beginning I got confused, but now I’m better (from chaos to harmony).
- Your webinar (Sync & Swim With CouchDB for IOS)
- J.Chris Anderson (TodoLite-PhoneGap & CouchChat-PhoneGap)
- Lorin Beer (anoter app)
- Andrew Reslan (Introduction to Couchbase Sync Gateway)
- And other Sync Gateway sources…
Nevertheless I can be missed somethings because I try to get better my English.
I think, Javascript is a very flexible language and for this reason there are lots of different library that was created by different person and logic. And for the same reason I think, Javascript is the most difficult way to develop a complex mobile application though I have never used Java. But I have the will to succeed!
Actually, some related parts of my codes like the following ;
var cblUrl;
var dbName = "user";
// I try to get Couchbase URL on DeviceReady event
if(window.cblite) {
window.cblite.getURL(function(err, url) {
if(err) {
console.log("error launching Couchbase Lite: " + err);
} else {
console.log("Couchbase Lite running at " + url);
cblUrl = url;
}
});
} else {
console.log("error, Couchbase Lite plugin not found.");
}
// I try to create a View when a user on tap Create button
$("#create").on("tap", function() {
var view = {
"language" : "javascript",
"views" : {
"user" : {
"map" : "function(doc) {if (doc.username) {emit(doc)}}"
}
}
}
$.ajax({
url: cblUrl + dbName + "/_design/user",
type: 'PUT',
data: view,
success: function (data, textStatus, xhr) {
console.log(xhr);
},
error: function (xhr, statusText, error) {
console.log(xhr);
}
});
});