Package mungbean.protocol.command.admin

Examples of mungbean.protocol.command.admin.IndexOptionsBuilder


        return new PojoDBCollection<T>(executor(), dbName(), name, type);
    }

    public GridFsStorage openStorage(String name) {
        DBCollection<GridFsFile> storageCollection = openStorageCollection(name + ".files", GridFsFile.class);
        storageCollection.collectionAdmin().ensureIndex(new IndexOptionsBuilder().field("files_id").field("n"));
        GridFsStorage storage = new GridFsStorage(storageCollection, openStorageCollection(name + ".chunks", GridFsChunk.class));
        return storage;
    }
View Full Code Here


            specify(result.get(0).get("csum"), does.equal(5D));
        }

        public void violationOfUniqueIndexThrowsAnException() {
            final DBCollection<Map<String, Object>> collection = context.openCollection("foo");
            collection.collectionAdmin().ensureIndex(new IndexOptionsBuilder().unique().field("foo"));
            collection.save(newDoc(new ObjectId(), "bar"));
            specify(new Block() {
                @Override
                public void run() throws Throwable {
                    collection.save(doc);
View Full Code Here

        public CollectionAdmin create() {
            return new CollectionAdmin(collection);
        }

        public void messageIsSerializedToByteStream() {
            context.ensureIndex(new IndexOptionsBuilder().dropDups().unique().field("foo"));
            specify(output.toByteArray().length, does.equal(153));
        }
View Full Code Here

    public ClojureCollectionAdmin(ClojureDBCollection collection) {
        super(collection);
    }

    public void ensureIndex(boolean unique, boolean dropDups, IPersistentStack fields) {
        IndexOptionsBuilder options = new IndexOptionsBuilder();
        while (fields.count() > 0) {
            Object fieldName = fields.peek();
            if (fieldName instanceof Keyword) {
                Keyword k = (Keyword) fieldName;
                fieldName = k.getName();
            }
            options.field(fieldName.toString()).ascending();
            fields = fields.pop();
        }
        if (unique) {
            options.unique();
        }
        if (dropDups) {
            options.dropDups();
        }
        ensureIndex(options);
    }
View Full Code Here

TOP

Related Classes of mungbean.protocol.command.admin.IndexOptionsBuilder

Copyright © 2018 www.massapicom. 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.