Package com.bazaarvoice.commons.data.dao.mongo.dbo

Examples of com.bazaarvoice.commons.data.dao.mongo.dbo.MongoDBObject


            dbCursor.sort(convertSortOrderToDBObject(sortOrder)).limit(1);

            logQueryDetails(dbCursor);

            Iterator<DBObject> iter = dbCursor.iterator();
            return iter.hasNext() ? _modelMarshaller.fromDBObject(new MongoDBObject(iter.next())) : null;
        } finally {
            dbCursor.close();
        }
    }
View Full Code Here


            logQueryDetails(dbCursor);

            List<T> list = Lists.newArrayList();
            for (DBObject dbObject : dbCursor) {
                list.add(_modelMarshaller.fromDBObject(new MongoDBObject(dbObject)));
            }
            return new SimpleQueryResults<T>(list, startIndex, dbCursor.count());
        } finally {
            dbCursor.close();
        }
View Full Code Here

        DBObject dbObject = getPrimaryCollection().findOne(new QueryMongoDBObject().forID(objectID));
        if (dbObject == null) {
            return null;
        }

        object = _modelMarshaller.fromDBObject(new MongoDBObject(dbObject));
        cacheObject(object);

        return object;
    }
View Full Code Here

    @Override
    public int nextSequenceValue(String sequenceName) {
        QueryMongoDBObject query = new QueryMongoDBObject().forID(sequenceName);
        UpdateMongoDBObject update = new UpdateMongoDBObject().$inc(SEQUENCE_VALUE_PROPERTY_NAME);

        MongoDBObject modifiedObject = new MongoDBObject(getSequenceCollection().findAndModify(query, null, null, false, update, true, true));
        return modifiedObject.getInt(SEQUENCE_VALUE_PROPERTY_NAME);
    }
View Full Code Here

            @Override
            public T apply(DBObject input) {
                if (input instanceof MongoDBObject) {
                    return marshaller.fromDBObject((MongoDBObject)input);
                } else {
                    return marshaller.fromDBObject(new MongoDBObject(input));
                }
            }
        };
    }
View Full Code Here

        logQueryDetails(dbCursor);

        return Iterables.transform(dbCursor, new Function<DBObject, T>() {
            @Override
            public T apply(DBObject dbObject) {
                return _modelMarshaller.fromDBObject(new MongoDBObject(dbObject));
            }
        });
    }
View Full Code Here

            dbCursor.sort(convertSortOrderToDBObject(sortOrder)).limit(1);

            logQueryDetails(dbCursor);

            Iterator<DBObject> iter = dbCursor.iterator();
            return iter.hasNext() ? _modelMarshaller.fromDBObject(new MongoDBObject(iter.next())) : null;
        } finally {
            dbCursor.close();
        }
    }
View Full Code Here

            logQueryDetails(dbCursor);

            List<T> list = Lists.newArrayList();
            for (DBObject dbObject : dbCursor) {
                list.add(_modelMarshaller.fromDBObject(new MongoDBObject(dbObject)));
            }
            return new SimpleQueryResults<T>(list, startIndex, dbCursor.count());
        } finally {
            dbCursor.close();
        }
View Full Code Here

        DBObject dbObject = getPrimaryCollection().findOne(new QueryMongoDBObject().forID(objectID));
        if (dbObject == null) {
            return null;
        }

        object = _modelMarshaller.fromDBObject(new MongoDBObject(dbObject));
        cacheObject(object);

        return object;
    }
View Full Code Here

    @Override
    public int nextSequenceValue(String sequenceName) {
        QueryMongoDBObject query = new QueryMongoDBObject().forID(sequenceName);
        UpdateMongoDBObject update = new UpdateMongoDBObject().$inc(SEQUENCE_VALUE_PROPERTY_NAME);

        MongoDBObject modifiedObject = new MongoDBObject(getSequenceCollection().findAndModify(query, null, null, false, update, true, true));
        return modifiedObject.getInt(SEQUENCE_VALUE_PROPERTY_NAME);
    }
View Full Code Here

TOP

Related Classes of com.bazaarvoice.commons.data.dao.mongo.dbo.MongoDBObject

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.