ArangoError: unique constraint violated - arangodb

My logging picked up an occurrence of the below error.
Its a very simple insert into an edge collection but the _key that was autogenerated already existed in that collection.
Details:
Save in an edge collection via a FOXX app.
Error: ArangoError: unique constraint violated - in index 0 of type primary over [“_key”]; conflicting key: 13647205
Arangodb version: 3.3.9 using RocksDB

Related

Azure Function OpenAPI - Error same key has already been added

I have a problem implementing OpenAPI in an Azure Function.
I am using the following package
Microsoft.Azure.WebJobs.Expensions.OpenApi
This is the error:
An item with the same key has already been added. Key: result_list`1
The cause is because I have several functions that are returning the same type CustomCollection<T>
How could you implement a solution for this issue?
Before inserting a data into a custom generic collection (CustomCollection<T>) try to remove/delete previous values or after got a values from function remove/delete the values in a CustomCollection<T>. This can helps to avoid conflict.
Try to use multiple CustomCollection<T> with different names can solve the problem.
Add a key value with some prefix or suffix characters while inserting.
Eg: Actual Key : result_list you can use as result_list_fun1 or fun1_result_list

Query Google Cloud Datastore to retrieve matching results

I am using Google Cloud Datastore to save my application data. I have to add a query to get all results matching with Name, Brand or Sku.
Query data with one of the field is returning me records but using all fields together returns me error.
Query:
const term = "My Red";
const q = gstore.createQuery(req.params.orgId, "Variant")
.filter('brand', '=', term)
.filter('sku', '=', term)
.limit(10);
Error:
{"msec":435.96913800016046,"error":"no matching index found.
recommended index is:- kind: Variant properties: -
name: brand - name:
sku","data":{"code":412,"metadata":{"_internal_repr":{}},"isBoom":true,"isServer":true,"data":null,"output":{"statusCode":500,"payload":{"statusCode":500,"error":"Internal
Server Error","message":"An internal server error
occurred"},"headers":{}}}} Debug: internal, error
Also, I want to perform OR operation to get matching results as above will return data with AND operation.
Please help me to find correct path to achieve the desired result.
Thanks in advance and let me know if something is not clear.
The error indicates that the composite index required by the respective query is not in Serving state.
That means it's either not created/deployed or it was recently deployed and is still being built.
Composite indexes must be specifically created and deployed in your app.
If you didn't create it you need to do so. The error message indicates the content the index configuration requires. If you're using the development server it might create it automatically, but you still need to deploy it.
See Indexes docs for more details.
If you recently deployed the composite index please note that it can take some significant amount of time until the matching index is built, depending on how many entities of that kind already exist in the Datastore. You can check the status of the index building in the developer console, on the Indexes page

ArangoDB 3.2 unique constraint violation _id or _key

I just read the issue from arangoDB github [1.1] Feature request: On unique constrain violation exceptions include ids or keys that were involved #342 (https://github.com/arangodb/arangodb/issues/342) because it is exactly what I was searching for.
Apparently this issue is already closed because it has been implemented in ArangoDB 3.2, however I do not find the way to retrieve the id or key from a unique constraint violation error.
For example I call the following AQL query on a collection with a Hash Index on "projectName" attribute.
# first insert - everything OK
INSERT {"projectName":"test","startDate":"now"} IN projects
RETURN NEW
# second insert - will give unique constraint violation error
INSERT {"projectName":"test","startDate":"tomorrow"} IN projects
RETURN NEW
Therefore the error that I get is: AQL: unique constraint violated (while executing). Errors: {u'code': 409, u'errorNum': 1210, u'errorMessage': u'AQL: unique constraint violated (while executing)', u'error': True}
with no _key or _id or something that tells me with which document do I have a unique constraint violation. Based on the closed issue it should be possible but I don't see how, or maybe I just understood it wrong.
Note: A similar question was posted in Determining which unique constraint caused INSERT failure in ArangoDB but I think it was answered before the release of ArangoDB 3.2
I am using ArangoDB 3.2.3
Thanks
It looks like that the index details are still omitted when triggering a unique constraint violation from within AQL. In this case it will only show/return a generic "unique constraint violated", but not indicate which index caused it.
This is unintentional, and there is now a pull request to fix this:
https://github.com/arangodb/arangodb/pull/3330

MongoDB NodeJS Driver: Duplicate key `E11000` extract index name

While using MongoDB NodeJS driver (or even mongoose), when inserting a new document, an E11000 error may return indicating a duplicate key collision has occurred.
What if the collection I am inserting into has multiple unique indices and I want to identify which one of them is hit (e.g. to notify the user the user that his username and/or email is already taken)?
This is the error raised after inserting a document with a colliding index:
{
"name": "MongoError",
"message": "E11000 duplicate key error index: db.users.$_id_ dup key: { : \"blucell\" }",
"driver": true,
"index": 0,
"code": 11000,
"errmsg": "E11000 duplicate key error index: db.users.$_id_ dup key: { : \"blucell\" }"
}
The only notion of the index causing the problem is in the message, which changes over time (already differs between mongo 2.x and 3.x).
Is there any more future-proof/easier way of checking which element/index is causing the collision?
Unfortunately there is no method as of MongoDB 3.4.7 that lists the colliding indexes in a separate, easy to parse field.
There is a discussion in Mongoose regarding this, but the solutions all rely on parsing the actual error message (see https://github.com/Automattic/mongoose/issues/2129).
Since the node driver just reports back the error given by the server, there is a MongoDB feature request for exactly this functionality (see SERVER-4637). I would suggest commenting/upvoting on the feature request to raise awareness of the issue.

SonarQube : cannot insert duplicate key row in object 'dbo.file_sources' with unique index 'file_sources_file_uuid_uniq'. The duplicate key value is

during the process migration of Sonar (from 4.5.7 to 5.4), we faced to an issue. The migration failed with this message :
Cannot insert duplicate key row in object 'dbo.file_sources' with uni
que index 'file_sources_file_uuid_uniq'. The duplicate key value is...
My database is an MS SQL Server. She's configured in FRENCH_CI_AS. I tried to change it in FRENCH_CS_AS, but it didn't solve the problem.
I've observed that, each time we restart the migration, the number of processed files was different. BUT it always failed by processing for the same file.
Any idea ?

Resources