1
서버의 내 App 및 CouchDB에서 PouchDB를 사용하여 서로 다른 두 개의 데이터베이스에 연결하고 동기화하려고합니다. 하나에 연결할 수 있지만 두 번째 연결이 제대로 작동하지 않습니다.PouchDB로 두 개의 다른 데이터베이스에 연결
내 코드는 다음과 같습니다
this._DB = new PouchDB('userdata');
let options = {
live: true,
retry: true,
continuous: true
};
this._syncHandler = this._DB.sync(remoteDB, options);
this._DB2 = new PouchDB('beer');
this._DB2.sync('localhost:5984/beer', options);
this._DB2.allDocs({})
.then((doc)=> {
console.log('****** TEST: doc = ' + JSON.stringify(doc));
})
.catch((err)=>{
console.log('****** TEST: err = ' + JSON.stringify(err));
});
내가 콘솔 로그는 '유저 데이터'데이터베이스가 아닌 '맥주'데이터베이스의 내용을 나열이 코드를 실행합니다. 이상한 것이지 의도 한 것이 아닙니다.
오류가 발생합니까? –
이상한 점이 없습니다. 새 PouchDB와 동기화가 제대로 작동하는 것 같고 콘솔 로그에 TEST : doc 출력이 표시되지만 문서의 내용은 매우 이상한 '맥주'데이터베이스가 아닌 'userdata'데이터베이스의 내용입니다. –
동기화 중에 'http : //'를 추가하십시오. Found https://pouchdb.com/api.html#sync –