| 570 | } // end of CollInsert |
| 571 | |
| 572 | public long CollUpdate(Object upd) { |
| 573 | long n = -1; |
| 574 | |
| 575 | if (DEBUG) |
| 576 | System.out.println("upd: " + upd.toString()); |
| 577 | |
| 578 | try { |
| 579 | UpdateResult res = coll.updateOne(Filters.eq("_id", doc.get("_id")), (Bson) upd); |
| 580 | |
| 581 | if (DEBUG) |
| 582 | System.out.println("CollUpdate: " + res.toString()); |
| 583 | |
| 584 | n = res.getModifiedCount(); |
| 585 | } catch (MongoException me) { |
| 586 | SetErrmsg(me); |
| 587 | } catch (Exception ex) { |
| 588 | SetErrmsg(ex); |
| 589 | } // end try/catch |
| 590 | |
| 591 | return n; |
| 592 | } // end of CollUpdate |
| 593 | |
| 594 | public long CollDelete(boolean all) { |
| 595 | long n = -1; |