Package com.mongodb

Examples of com.mongodb.DBObject.keySet()


            }

            Object paramsValue = result.get(FIELD_PARAMS);
            if (paramsValue instanceof DBObject) {
                DBObject params = (DBObject) paramsValue;
                for (String key : params.keySet()) {
                    state.setParameter(key, params.get(key).toString().trim());
                }

            }
View Full Code Here


    for (Entry<String, Object> capability : capabilitiesObj.entrySet()) {
      EventType eventType = EventType.valueOf(capability.getKey());
      List<Context> contexts = CollectionUtils.newArrayList();
      DBObject capabilityObj = (DBObject) capability.getValue();
      DBObject contextsObj = (DBObject) capabilityObj.get(CAPABILITY_CONTEXTS_FIELD);
      for (String contextId : contextsObj.keySet()) {
        contexts.add(Context.valueOf((String) contextsObj.get(contextId)));
      }
      String filter = (String) capabilityObj.get(CAPABILITY_FILTER_FIELD);

      capabilities.put(eventType, new Capability(eventType, contexts, filter));
View Full Code Here

        final DBObject object = instances.findOne();
       
        assertEquals(SPEC_NAME+":"+"D01", object.get("_oid"));
        assertEquals("D01", object.get("_id"));
       
        assertEquals(2, object.keySet().size());
    }

    @Test
    public void writeFields() throws Exception {
        //writer.writeObjectType(SPEC_NAME);
View Full Code Here

        final DBCursor cursor = collection.find().limit(1000);

        final SortedMap<String, Set<Class<?>>> columnsAndTypes = new TreeMap<String, Set<Class<?>>>();
        while (cursor.hasNext()) {
            DBObject object = cursor.next();
            Set<String> keysInObject = object.keySet();
            for (String key : keysInObject) {
                Set<Class<?>> types = columnsAndTypes.get(key);
                if (types == null) {
                    types = new HashSet<Class<?>>();
                    columnsAndTypes.put(key, types);
View Full Code Here

      long id = (Long) event.get("id");
      long time = (Long) event.get("time");
      int type = (Integer) event.get("type");
      Properties properties = new Properties();
      DBObject propertiesDbObject = (DBObject) event.get("properties");
      for (String key : propertiesDbObject.keySet()) {
        properties.put(key, propertiesDbObject.get(key));
      }

      logevents.add(new LogEvent(targetId, logId, id, time, type,
          properties));
View Full Code Here

    DBObject row = dbCollection.findOne(rowKey);
    if(row == null) {
      return;
    }
    else {
      Set<String> fieldSet = row.keySet();
      //String fromField = StandardConverters.convertToString(from);
      //String toField = StandardConverters.convertToString(to);
      //String fromField = StandardConverters.convertFromBytes(String.class, from);
      //String toField = StandardConverters.convertFromBytes(String.class, to);
      ByteArray fromField = new ByteArray(from);
View Full Code Here





        for(String s: doc.keySet()) {
            System.out.printf("%25s:%s\n", s, doc.get(s));
        }

    }
View Full Code Here

    private static void massageTweet(final DBObject cur) throws ParseException {
        SimpleDateFormat fmt = new SimpleDateFormat("EEE MMM d H:m:s Z y");
        cur.put("created_at", fmt.parse((String) cur.get("created_at")));

        DBObject userDoc = (DBObject) cur.get("user");
        Iterator<String> keyIterator = userDoc.keySet().iterator();
        while (keyIterator.hasNext()) {
            String key = keyIterator.next();
            if (!(key.equals("id") || key.equals("name") || key.equals("screen_name"))) {
                keyIterator.remove();
            }
View Full Code Here

        KeyValue<Row> kv = new KeyValue<Row>();
        byte[] mdbRowKey = StandardConverters.convertToBytes(mdbrow
            .get("_id"));
        kv.setKey(mdbRowKey);

        if (!mdbrow.keySet().isEmpty()) {
          Row r = rowProvider.get();
          r.setKey(mdbRowKey);
          MongoDbUtil.processColumns(mdbrow, r);
          kv.setValue(r);
        }
View Full Code Here

        final DBCursor cursor = collection.find().limit(1000);

        final SortedMap<String, Set<Class<?>>> columnsAndTypes = new TreeMap<String, Set<Class<?>>>();
        while (cursor.hasNext()) {
            DBObject object = cursor.next();
            Set<String> keysInObject = object.keySet();
            for (String key : keysInObject) {
                Set<Class<?>> types = columnsAndTypes.get(key);
                if (types == null) {
                    types = new HashSet<Class<?>>();
                    columnsAndTypes.put(key, types);
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.