| 501 | } // end of CollUpdate |
| 502 | |
| 503 | public long CollDelete(boolean all) { |
| 504 | long n = -1; |
| 505 | |
| 506 | try { |
| 507 | WriteResult res; |
| 508 | BasicDBObject qry = new BasicDBObject(); |
| 509 | |
| 510 | if (!all) |
| 511 | qry.append("_id", doc.get("_id")); |
| 512 | |
| 513 | res = coll.remove(qry); |
| 514 | |
| 515 | if (DEBUG) |
| 516 | System.out.println("CollDelete: " + res.toString()); |
| 517 | |
| 518 | n = res.getN(); |
| 519 | } catch (WriteConcernException wx) { |
| 520 | SetErrmsg(wx); |
| 521 | } catch (MongoException me) { |
| 522 | SetErrmsg(me); |
| 523 | } catch (UnsupportedOperationException ux) { |
| 524 | SetErrmsg(ux); |
| 525 | n = 0; |
| 526 | } // end try/catch |
| 527 | |
| 528 | return n; |
| 529 | } // end of CollDelete |
| 530 | |
| 531 | } // end of class MongoInterface |