Package com.mongodb

Examples of com.mongodb.DBCursor.addOption()


        if (null != readPref) {
            cursor.setReadPreference(readPref);
        }

        if (noTimeout) {
            cursor.addOption(Bytes.QUERYOPTION_NOTIMEOUT);
        }

        if (tail) {
            cursor.addOption(Bytes.QUERYOPTION_TAILABLE);
            if (tail_await_data)
View Full Code Here


        if (noTimeout) {
            cursor.addOption(Bytes.QUERYOPTION_NOTIMEOUT);
        }

        if (tail) {
            cursor.addOption(Bytes.QUERYOPTION_TAILABLE);
            if (tail_await_data)
                cursor.addOption(Bytes.QUERYOPTION_AWAITDATA);
        }

        //Check for bad options.
View Full Code Here

        }

        if (tail) {
            cursor.addOption(Bytes.QUERYOPTION_TAILABLE);
            if (tail_await_data)
                cursor.addOption(Bytes.QUERYOPTION_AWAITDATA);
        }

        //Check for bad options.
        if (snapshotted && (sort != null || indexHint != null))
            log.warning("Snapshotted query should not have hint/sort.");
View Full Code Here

    }

    private void addTargetHashToAlerts() {
        LOGGER.info("Adding targetHash field to any alerts which don't have it");
        DBCursor alerts = getAlertsCollection().find(new BasicDBObject("targetHash", new BasicDBObject("$exists", false)));
        alerts.addOption(Bytes.QUERYOPTION_NOTIMEOUT);
        int alertCount = alerts.count();
        if (alertCount > 0) {
            LOGGER.info("Found {} alert(s) which need updating", alertCount);
        }
        while (alerts.hasNext()) {
View Full Code Here

    {
        // cursor over collection
        BasicDBObject query = new BasicDBObject();
        DBCursor cursor = metaResultsColl.find( query );
        // avoid cursor timeout
        cursor.addOption( Bytes.QUERYOPTION_NOTIMEOUT );
        // map to store fieldname and ClasCount object holding type and type-count info
        HashMap<String, ClassCount> fieldMap = new HashMap<String, ClassCount>();

        try
        {
View Full Code Here

        System.out.println("starting point: " + ts);

        while (true) {
            System.out.println("starting at ts: " + ts);
            DBCursor cursor = oplog.find(new BasicDBObject("ts", new BasicDBObject("$gt", ts)));
            cursor.addOption(Bytes.QUERYOPTION_TAILABLE);
            cursor.addOption(Bytes.QUERYOPTION_AWAITDATA);
            while (cursor.hasNext()) {
                DBObject x = cursor.next();
                ts = (BSONTimestamp) x.get("ts");
                System.out.println("\t" + x);
View Full Code Here

        while (true) {
            System.out.println("starting at ts: " + ts);
            DBCursor cursor = oplog.find(new BasicDBObject("ts", new BasicDBObject("$gt", ts)));
            cursor.addOption(Bytes.QUERYOPTION_TAILABLE);
            cursor.addOption(Bytes.QUERYOPTION_AWAITDATA);
            while (cursor.hasNext()) {
                DBObject x = cursor.next();
                ts = (BSONTimestamp) x.get("ts");
                System.out.println("\t" + x);
            }
View Full Code Here

    @Override
    public void visitEvents(Criteria criteria, EventVisitor visitor) {
        DBCursor cursor = storageStrategy.findEvents(mongoTemplate.domainEventCollection(),
                                                     (MongoCriteria) criteria);
        cursor.addOption(Bytes.QUERYOPTION_NOTIMEOUT);
        CursorBackedDomainEventStream events = new CursorBackedDomainEventStream(cursor, null, null, true);
        try {
            while (events.hasNext()) {
                visitor.doWithEvent(events.next());
            }
View Full Code Here

        if (null != readPref) {
            cursor.setReadPreference(readPref);
        }

        if (noTimeout) {
            cursor.addOption(Bytes.QUERYOPTION_NOTIMEOUT);
        }

        if (tail) {
            cursor.addOption(Bytes.QUERYOPTION_TAILABLE);
            if (tailAwaitData) {
View Full Code Here

        if (noTimeout) {
            cursor.addOption(Bytes.QUERYOPTION_NOTIMEOUT);
        }

        if (tail) {
            cursor.addOption(Bytes.QUERYOPTION_TAILABLE);
            if (tailAwaitData) {
                cursor.addOption(Bytes.QUERYOPTION_AWAITDATA);
            }
        }
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.