Package com.mongodb

Examples of com.mongodb.DBCollection.save()


    protected void doSave(Exchange exchange) throws Exception {
        DBCollection dbCol = calculateCollection(exchange);
        DBObject saveObj = exchange.getIn().getMandatoryBody(DBObject.class);
       
        WriteConcern wc = extractWriteConcern(exchange);
        WriteResult result = wc == null ? dbCol.save(saveObj) : dbCol.save(saveObj, wc);
       
        prepareResponseMessage(exchange, MongoDbOperation.save);
        // we always return the WriteResult, because whether the getLastError was called or not, the user will have the means to call it or
        // obtain the cached CommandResult
        processAndTransferWriteResult(result, exchange);
View Full Code Here


    protected void doSave(Exchange exchange) throws Exception {
        DBCollection dbCol = calculateCollection(exchange);
        DBObject saveObj = exchange.getIn().getMandatoryBody(DBObject.class);
       
        WriteConcern wc = extractWriteConcern(exchange);
        WriteResult result = wc == null ? dbCol.save(saveObj) : dbCol.save(saveObj, wc);
        processWriteResult(result, exchange);
        // we always return the WriteResult, because whether the getLastError was called or not, the user will have the means to call it or
        // obtain the cached CommandResult
        exchange.getOut().setBody(result);
    }
View Full Code Here

    protected void doSave(Exchange exchange) throws Exception {
        DBCollection dbCol = calculateCollection(exchange);
        DBObject saveObj = exchange.getIn().getMandatoryBody(DBObject.class);
       
        WriteConcern wc = extractWriteConcern(exchange);
        WriteResult result = wc == null ? dbCol.save(saveObj) : dbCol.save(saveObj, wc);
        processWriteResult(result, exchange);
        // we always return the WriteResult, because whether the getLastError was called or not, the user will have the means to call it or
        // obtain the cached CommandResult
        exchange.getOut().setBody(result);
    }
View Full Code Here

                }
            }

            StoreFieldManager fieldManager = new StoreFieldManager(op, dbObject, cmd);
            op.provideFields(cmd.getAllMemberPositions(), fieldManager);
            collection.save(dbObject);

            if (NucleusLogger.DATASTORE_PERSIST.isDebugEnabled())
            {
                NucleusLogger.DATASTORE_PERSIST.debug(LOCALISER.msg("MongoDB.ExecutionTime",
                    (System.currentTimeMillis() - startTime)));
View Full Code Here

    protected void doSave(Exchange exchange) throws Exception {
        DBCollection dbCol = calculateCollection(exchange);
        DBObject saveObj = exchange.getIn().getMandatoryBody(DBObject.class);

        WriteConcern wc = extractWriteConcern(exchange);
        WriteResult result = wc == null ? dbCol.save(saveObj) : dbCol.save(saveObj, wc);

        prepareResponseMessage(exchange, MongoDbOperation.save);
        // we always return the WriteResult, because whether the getLastError was called or not, the user will have the means to call it or
        // obtain the cached CommandResult
        processAndTransferWriteResult(result, exchange);
View Full Code Here

    protected void doSave(Exchange exchange) throws Exception {
        DBCollection dbCol = calculateCollection(exchange);
        DBObject saveObj = exchange.getIn().getMandatoryBody(DBObject.class);

        WriteConcern wc = extractWriteConcern(exchange);
        WriteResult result = wc == null ? dbCol.save(saveObj) : dbCol.save(saveObj, wc);

        prepareResponseMessage(exchange, MongoDbOperation.save);
        // we always return the WriteResult, because whether the getLastError was called or not, the user will have the means to call it or
        // obtain the cached CommandResult
        processAndTransferWriteResult(result, exchange);
View Full Code Here

            for (int i=0;i<size;i++)
            {
                oids.add(number + i + 1);
            }
            dbObject.put(INCREMENT_COL_NAME, new Long(number+size));
            dbCollection.save(dbObject);
        }
        finally
        {
            connectionProvider.releaseConnection();
        }
View Full Code Here

        DBObject object = system.findOne();
        if (object == null) {
            object = new BasicDBObject();
        }
        object.put("next-id", Long.toString(serialNumber));
        system.save(object);
        LOG.info("serial number written: " + serialNumber);
    }

    public long readSerialNumber() {
        final DBCollection system = db.getCollection("serialnumbers");
View Full Code Here

                .append("id", event.getID())
                .append("time", event.getTime())
                .append("type", event.getType())
                .append("properties", event.getProperties());

            collection.save(dbObject);
        }
    }

    @Override
    public List<Descriptor> getDescriptors(String targetID)
View Full Code Here

            throw new CollectionObjectNotFoundException(datasourceType, collectionName, id);
        }

        newPayloadObject.put("_id", id);

        collection.save(newPayloadObject);

        return newPayloadObject;
    }

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.