Examples of MinKey


Examples of org.bson.types.MinKey

            break;
        case BsonConstants.TYPE_MAX_KEY:
            value = new MaxKey();
            break;
        case BsonConstants.TYPE_MIN_KEY:
            value = new MinKey();
            break;
        case BsonConstants.TYPE_JAVASCRIPT_CODE:
        case BsonConstants.TYPE_JAVASCRIPT_CODE_WITH_SCOPE:
            throw new IOException("unhandled type: 0x" + Integer.toHexString(type));
        default:
View Full Code Here

Examples of org.bson.types.MinKey

    @Test
    public void testDecodeObjects() throws Exception {
        List<BSONObject> objects = new ArrayList<BSONObject>();
        objects.add(new BasicBSONObject("key", new MaxKey()).append("foo", "bar"));
        objects.add(new BasicBSONObject("key", new MinKey()).append("test", new MaxKey()));

        for (BSONObject object : objects) {
            byte[] encodedData = new BasicBSONEncoder().encode(object);
            ByteBuf buf = Unpooled.wrappedBuffer(encodedData).order(ByteOrder.LITTLE_ENDIAN);
            BSONObject decodedObject = new BsonDecoder().decodeBson(buf);
View Full Code Here

Examples of org.bson.types.MinKey

                BasicDBObject prev = (BasicDBObject) cur.next();
                BasicDBObject next = null;
                // snap prev to minkey
                BasicDBObject theid = (BasicDBObject) prev.get("_id");
                for (String key : shardKey.keySet()) {
                    theid.put(key, new MinKey());
                }
                String currentShard = prev.getString("_shard");

                int i = 1;
                while (cur.hasNext()) {
View Full Code Here

Examples of org.bson.types.MinKey

        } else if (type.equals("Null")) {
            val = null;
        } else if (type.equals("UUID")) {
            val = UUID.randomUUID();
        } else if (type.equals("MinKey")) {
            val = new MinKey();
        } else if (type.equals("MaxKey")) {
            val = new MaxKey();
        }

        if (value == null) {
View Full Code Here

Examples of org.bson.types.MinKey

    }

    private static class MinKeyDeserializer extends JsonDeserializer<MinKey> {
        @Override
        public MinKey deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException {
            return new MinKey();
        }
View Full Code Here

Examples of org.bson.types.MinKey

    @Test
    public void testMinMaxKey()
        throws MongoException {
        DBCollection c = collection;
        c.save( BasicDBObjectBuilder.start().add( "min" , new MinKey() ).add( "max" , new MaxKey() ).get() );

        DBObject out = c.findOne();
        MinKey min = (MinKey)(out.get( "min" ) );
        MaxKey max = (MaxKey)(out.get( "max" ) );
        assertTrue( JSON.serialize(min).contains("$minKey") );
        assertTrue( JSON.serialize(max).contains("$maxKey") );
    }
View Full Code Here

Examples of org.bson.types.MinKey

    public void gotUndefined(final String name) {
    }

    @Override
    public void gotMinKey(final String name) {
        cur().put( name , new MinKey() );
    }
View Full Code Here

Examples of org.bson.types.MinKey

        Pattern test_regex = Pattern.compile( "^test.*regex.*xyz$", Pattern.CASE_INSENSITIVE );
        BasicDBObjectBuilder b = BasicDBObjectBuilder.start();
        b.append( "_id", oid );
        b.append( "null", null );
        b.append( "max", new MaxKey() );
        b.append( "min", new MinKey() );
        b.append( "booleanTrue", true );
        b.append( "booleanFalse", false );
        b.append( "int1", 1 );
        b.append( "int1500", 1500 );
        b.append( "int3753", 3753 );
View Full Code Here

Examples of org.bson.types.MinKey

            case BSON.NULL:
                return null;
            case BSON.MAXKEY:
                return new MaxKey();
            case BSON.MINKEY:
                return new MinKey();
            case BSON.BOOLEAN:
                return ( _input.get( record.valueOffset ) != 0 );
            case BSON.NUMBER_INT:
                return _input.getInt( record.valueOffset );
            case BSON.TIMESTAMP:
View Full Code Here

Examples of org.bson.types.MinKey

        serializer.serialize(new MaxKey(), buf);
        assertEquals(buf.toString(), "{ \"$maxKey\" : 1}");
       
        // test  MINKEY
        buf = new StringBuilder();
        serializer.serialize(new MinKey(), buf);
        assertEquals(buf.toString(), "{ \"$minKey\" : 1}");
       
        // test  NULL
        buf = new StringBuilder();
        serializer.serialize(null, buf);
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.