Code Monkey home page Code Monkey logo

Comments (6)

mvollmary avatar mvollmary commented on August 29, 2024

Hi,
you can perform an upsert only via AQL.
https://docs.arangodb.com/3.0/AQL/Operations/Upsert.html

Regards,
Mark

from arangodb-java-driver.

sajeevpr avatar sajeevpr commented on August 29, 2024

Hi Mark,
Thanks for your response. So can I use updateDocument for update and insert using the java API.

Regards,
Sajeev

from arangodb-java-driver.

mvollmary avatar mvollmary commented on August 29, 2024

With updateDocument you can only update a document, if it doesn't exists you get an error.
With createDocument you can only insert a document, if it exists already you get an error.
With executeAqlQuery you can perform an AQL to upsert a document.

If you never worked with AQL before, check out our documentation: https://docs.arangodb.com/3.0/AQL/index.html

from arangodb-java-driver.

rocketraman avatar rocketraman commented on August 29, 2024

With executeAqlQuery you can perform an AQL to upsert a document.

For future searchers, this is called query now. See https://github.com/arangodb/arangodb-java-driver/blob/master/docs/Drivers/Java/Reference/Database/Queries.md.

from arangodb-java-driver.

udarajag avatar udarajag commented on August 29, 2024

Is the upsert function available using java driver yet?

from arangodb-java-driver.

rashtao avatar rashtao commented on August 29, 2024

In addition you can also insertDocument setting overwrite in the provided DocumentCreateOptions, which means:

	 * @param overwrite If set to true, the insert becomes a replace-insert. If a document with the same {@code _key}
	 *                  already exists the new document is not rejected with unique constraint violated but will replace
	 *                  the old document.

/**
* @param overwrite If set to true, the insert becomes a replace-insert. If a document with the same {@code _key}
* already exists the new document is not rejected with unique constraint violated but will replace
* the old document.
* @return options
* @since ArangoDB 3.4
*/
public DocumentCreateOptions overwrite(final Boolean overwrite) {
this.overwrite = overwrite;
return this;
}

from arangodb-java-driver.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.