| 477 | } // end of CollInsert |
| 478 | |
| 479 | public long CollUpdate(Object upd) { |
| 480 | long n = -1; |
| 481 | |
| 482 | if (DEBUG) |
| 483 | System.out.println("upd: " + upd.toString()); |
| 484 | |
| 485 | try { |
| 486 | DBObject qry = new BasicDBObject("_id", doc.get("_id")); |
| 487 | |
| 488 | WriteResult res = coll.update(qry, (DBObject) upd); |
| 489 | |
| 490 | if (DEBUG) |
| 491 | System.out.println("CollUpdate: " + res.toString()); |
| 492 | |
| 493 | n = res.getN(); |
| 494 | } catch (MongoException me) { |
| 495 | SetErrmsg(me); |
| 496 | } catch (Exception ex) { |
| 497 | SetErrmsg(ex); |
| 498 | } // end try/catch |
| 499 | |
| 500 | return n; |
| 501 | } // end of CollUpdate |
| 502 | |
| 503 | public long CollDelete(boolean all) { |
| 504 | long n = -1; |