phonegap을 사용하여 모바일 앱을 만들고 있습니다.Phonegap/Cordova 및 Couchbase 모바일/서버
Couchbase를 사용하여 데이터를 저장하기로 결정했습니다. 하지만 나는 Couchbase 모바일을 사용해야 할 것인지 아니면 couchbase 서버에 직접 (자바 스크립트) 내 앱을 연결할 수 있는지 그리고 내 .net 앱을 '쿼리'하는 방법을 알 수는 없습니다.
내 시스템에 couchbase 서버를 다운로드했지만 내 응용 프로그램과 연결하는 방법은 무엇입니까?
N1QL을 사용하여 phonegap을 사용하여 .NET에서 서버에 '쿼리'할 수 있습니까? (couchbase mobile이 n1ql을 지원하지 않기 때문에).
.NET 또는 JAVA로 완료 한 나머지 웹 서비스를 호출 할 수 있지만 응용 프로그램에 couchbase 모바일을 추가해야합니까?
이 C 번호의 쿼리가 모바일 문서 카우치베이스 주식회사입니다 : 내가 전화하는 방법
var document = database.CreateDocument();
var properties = new Dictionary<string, object>()
{
{"type", "list"},
{"title", "title"},
{"created_at", DateTime.UtcNow.ToString ("o")},
{"owner", "profile:" + userId},
{"members", new List<string>()}
};
var rev = document.PutProperties(properties);
Debug.Assert(rev != null);
를? 서로 다른 이유
var doc = new Document<dynamic>{ Id = "document_id", Content = new {Some="value"} };
var result = bucket.Insert(doc);
Console.WriteLine(JsonConvert.SerializeObject(result.Document));
:
이 서버 문서에서 쿼리 (이전 모바일에 있었다)입니다? 나는 조금 혼란 스러워요 경우
var DB_NAME = 'todo';
function initRESTClient(url) {
var client = new SwaggerClient({
spec: window.spec,
usePromise: true,
})
.then(function (client) {
client.setHost(url);
if (device.platform == 'android') {
var encodedCredentials = "Basic " + window.btoa(url.split('/')[1].split('@')[0]);
client.clientAuthorizations.add("auth", new SwaggerClient.ApiKeyAuthorization('Authorization', encodedCredentials, 'header'));
}
client.server.get_all_dbs()
.then(function (res) {
var dbs = res.obj;
if (dbs.indexOf(DB_NAME) == -1) {
return client.database.put_db({db: DB_NAME});
}
return client.database.get_db({db: DB_NAME});
})
.then(function (res) {
return client.document.post({db: DB_NAME, body: {title: 'Couchbase Mobile', sdk: 'PhoneGap'}});
})
.then(function (res) {
console.log('Document ID :: ' + res.obj.id);
})
.catch(function (err) {
console.log(err);
});
});
}
미안하지만 좀 높은 수준의 코딩을 시작하는 명확히해야
이
은 폰갭에 서버를 연결하는 기능입니다.
클라이언트의 Cordova SQLite 어댑터로 https://pouchdb.com/를 볼 수도 있습니다. –