Package com.mongodb

Examples of com.mongodb.DBObject.keySet()


                {
                    equal = false;
                }
                else
                {
                    Iterator<String> indicKeyIter = key.keySet().iterator();
                    while (indicKeyIter.hasNext())
                    {
                        String fieldKey = indicKeyIter.next();
                        Object fieldValue = key.get(fieldKey);
                        if (!idxObj.containsField(fieldKey))
View Full Code Here


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

            Events.add(new Event(targetId, logId, id, time, type, properties));
        }
View Full Code Here

        final DBCollection instances = testDb.getCollection(SPEC_NAME);
        assertEquals(1, instances.getCount());
        final DBObject object = instances.findOne();
        assertNotNull(object.get("_id"));
        assertEquals("D01", object.get("_id"));
        assertEquals(1, object.keySet().size());
    }

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

        session.willPassivate();
        try
        {    
            DBObject attrs = (DBObject)getNestedValue(o,getContextKey());   
            //if disk version now has no attributes, get rid of them
            if (attrs == null || attrs.keySet().size() == 0)
            {
                session.clearAttributes();
            }
            else
            {
View Full Code Here

                session.clearAttributes();
            }
            else
            {
                //iterate over the names of the attributes on the disk version, updating the value
                for (String name : attrs.keySet())
                {
                    //skip special metadata field which is not one of the session attributes
                    if (__METADATA.equals(name))
                        continue;
View Full Code Here

                }
                // cleanup, remove values from session, that don't exist in data anymore:
                for (String str : session.getNames())
                {
                   if (!attrs.keySet().contains(encodeName(str)))
                   {
                        session.doPutOrRemove(str,null);
                        session.unbindValue(str,session.getAttribute(str));
                    }
                }
View Full Code Here

            {
                __log.debug("MongoSessionManager: session {} present for context {}", clusterId, getContextKey());
                //only load a session if it exists for this context
                session = new NoSqlSession(this,created,accessed,clusterId,version);
               
                for (String name : attrs.keySet())
                {
                    //skip special metadata attribute which is not one of the actual session attributes
                    if ( __METADATA.equals(name) )
                        continue;
                   
View Full Code Here

    MongoRepositoryItem item = new MongoRepositoryItem(this, dbFile);

    Map<String, String> metadata = new HashMap<>();
    DBObject object = dbFile.getMetaData();
    for (String key : object.keySet()) {
      metadata.put(key, object.get(key).toString());
    }
    item.setMetadata(metadata);
    return item;
  }
View Full Code Here

    @Test
    public void testQueryWithFieldSelector() throws Exception {
        collection.insert(json("foo: 'bar'"));
        DBObject obj = collection.findOne(json("{}"), json("foo: 1"));
        assertThat(obj.keySet()).containsOnly("_id", "foo");

        obj = collection.findOne(json("foo:'bar'"), json("_id: 1"));
        assertThat(obj.keySet()).containsOnly("_id");

        obj = collection.findOne(json("foo: 'bar'"), json("_id: 0, foo:1"));
View Full Code Here

        collection.insert(json("foo: 'bar'"));
        DBObject obj = collection.findOne(json("{}"), json("foo: 1"));
        assertThat(obj.keySet()).containsOnly("_id", "foo");

        obj = collection.findOne(json("foo:'bar'"), json("_id: 1"));
        assertThat(obj.keySet()).containsOnly("_id");

        obj = collection.findOne(json("foo: 'bar'"), json("_id: 0, foo:1"));
        assertThat(obj.keySet()).containsOnly("foo");
    }
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.