Package com.mongodb

Examples of com.mongodb.DBRef.fetch()


    DBObject mapValDBObject = new BasicDBObject();
    mapValDBObject.put("_id", BigInteger.ONE);

    DBRef dbRef = mock(DBRef.class);
    when(dbRef.fetch()).thenReturn(mapValDBObject);

    ((DBObject) dbObject.get("map")).put("test", dbRef);

    MapDBRef read = converter.read(MapDBRef.class, dbObject);
View Full Code Here


  @Test
  @SuppressWarnings({ "rawtypes", "unchecked" })
  public void resolvesDBRefMapValue() {

    DBRef dbRef = mock(DBRef.class);
    when(dbRef.fetch()).thenReturn(new BasicDBObject());

    BasicDBObject refMap = new BasicDBObject("foo", dbRef);
    DBObject dbObject = new BasicDBObject("personMap", refMap);

    DBRefWrapper result = converter.read(DBRefWrapper.class, dbObject);
View Full Code Here

        if (cached != null) {
            return cached;
        }

        //TODO: if _db is null, set it?
        final DBObject refDbObject = idOnly ? ds.getCollection(key.getKindClass()).findOne(ref) : dbRef.fetch();

        if (refDbObject != null) {
            Object refObj = mapper.getOptions().getObjectFactory().createInstance(mapper, mf, refDbObject);
            refObj = mapper.fromDb(refDbObject, refObj, cache);
            cache.putEntity(key, refObj);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.