File tree Expand file tree Collapse file tree 2 files changed +15
-4
lines changed
packages/nativescript-couchbase Expand file tree Collapse file tree 2 files changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -136,13 +136,16 @@ export class CouchBase extends Common {
136
136
}
137
137
138
138
deleteDocument ( documentId : string , concurrencyMode : ConcurrencyMode = ConcurrencyMode . LastWriteWins ) {
139
+ let success = false ;
139
140
try {
140
141
const doc = this . android . getDocument ( documentId ) ;
141
- return this . android . delete ( doc , concurrencyMode === ConcurrencyMode . FailOnConflict ? com . couchbase . lite . ConcurrencyControl . FAIL_ON_CONFLICT : com . couchbase . lite . ConcurrencyControl . LAST_WRITE_WINS ) ;
142
+ if ( doc != null ) {
143
+ success = this . android . delete ( doc , concurrencyMode === ConcurrencyMode . FailOnConflict ? com . couchbase . lite . ConcurrencyControl . FAIL_ON_CONFLICT : com . couchbase . lite . ConcurrencyControl . LAST_WRITE_WINS ) ;
144
+ }
142
145
} catch ( e ) {
143
146
console . error ( e . message ) ;
144
- return false ;
145
147
}
148
+ return success ;
146
149
}
147
150
148
151
destroyDatabase ( ) {
Original file line number Diff line number Diff line change @@ -398,8 +398,16 @@ export class CouchBase extends Common {
398
398
}
399
399
400
400
deleteDocument ( documentId : string , concurrencyMode : ConcurrencyMode = 1 ) {
401
- const doc = this . ios . documentWithID ( documentId ) ;
402
- return this . ios . deleteDocumentConcurrencyControlError ( doc , concurrencyMode === 1 ? CBLConcurrencyControl . kCBLConcurrencyControlFailOnConflict : CBLConcurrencyControl . kCBLConcurrencyControlLastWriteWins ) ;
401
+ let success = false ;
402
+ try {
403
+ const doc = this . ios . documentWithID ( documentId ) ;
404
+ if ( doc != null ) {
405
+ success = this . ios . deleteDocumentConcurrencyControlError ( doc , concurrencyMode === 1 ? CBLConcurrencyControl . kCBLConcurrencyControlFailOnConflict : CBLConcurrencyControl . kCBLConcurrencyControlLastWriteWins ) ;
406
+ }
407
+ } catch ( e ) {
408
+ console . error ( e . message ) ;
409
+ }
410
+ return success ;
403
411
}
404
412
405
413
destroyDatabase ( ) {
You can’t perform that action at this time.
0 commit comments