Hi Im running couchabse server 7.1.3 docker container and trying to use the 3.3.4 couchbase java sdk version. I am facing an issue while performing subdocument mutation using the upsert command.
The issue I am facing is when I use the collection.mutateIn() method to perform a subdocument mutation using the upsert command, I am expecting to get the result of the operation as a MutateInResult object. when I try to use the MutateInResult.contentAs(0, String.class) to see the response I get the Index 0 is invalid error. I see that the operation as in is successful in the DB, I can see the desired json path has the updated value.
P.S: I only have a single mutation to perform which is the upsert command.
can someone please help if I am missing something here?
Related
I want to get the logs of each AQL query or operation running with the arangojs SDK for ArangoDB.
I know ArangoDB maintains the logs in GUI but I just want the main DB operation logs which my code performs and attach them with any custom logger or simply with console.log
Here are the things I want to log:
Full Query
Variables used in the query
Total time it took for the query to run
Error, if occurred
Is there any middleware or callback method available to inject it with arangojs methods?
PS: I'm using arangoJS with NodeJS and GraphQL.
When i creating indexes via createIndex or ensureIndex methods my node.js app crashing without providing any details of occured error.
Also i have noticed that all my code works very well with my localhost mongodb until i use remote mongdb atlas replica set.
Node.js: 8.5.0
Mongodb: 3.6.4
Mongodb driver for Node.js: 3.0.8
Example code (but i have tried different variants of implementation, nothing helps):
db.collection('stars').ensureIndex({name: 1}, { unique: true });
I am already listening for uncaughtException and unhandledRejection events, but they dont fire on this crash.
What can i do to get details or get rid of this error?
Thanks for any help!
I updated my mongodb driver to version 3.1.0 and eventually got error message with description of reason that causes the problem. According to error message: "The field "retryWrites" is not valid for for an index specification". So, i think the problem was with this field that i used to add to my connection uri string. After removing this field i got rid of this problem.
The problem might be connected with this issue: NODE-1641. I've got similar problem and found a few solutions:
Locking driver version at 3.1.0 and adding useNewUrlParser: true in connection options.
In createIndex add field retryWrites: null, so in your case it will look like:
db.collection('stars').ensureIndex({name: 1}, { unique: true, retryWrites: null });
However you need to check if it won't turn off retryable writes for that collection.
Last option is to vote up that issue and hope that it will be resolved soon, and then update your driver.
Not sure if this will help, but I'm currently trying to work around this.
If you remove {unique: true} it should get the job done, but it will make duplicate documents if you add the same document over again.
Working with express(nodejs), mongoose, and Azure Cosmos DB to return objects.
When I connect to my local mongodb, the following code correctly returns a list of commit objects that exist in local mongodb.
Commit
.find({}, function(err, commits) {
if (err) {
res.render('search/index', {});
} else {
res.json(commits);
}
});
However, when connecting to Azure Cosmos DB using a PRIMARY CONNECTION STRING shown on my Azure portal website, the code just returns an empty list.
I checked that the mongoose.connection.readyState value is 1.
In addition, I can connect to the Azure Cosmos DB using Robo 3T.
Mongoose was designed to work with MongoDB. If your local testing with a real MongoDB server yields the expected result, then the fault is unlikely to be in mongoose or your code. Since CosmosDB only attempts to mimic MongoDB's API, there is no guarantee that it will work the same way. In your case, apparently it doesn't.
Being able to connect to CosmosDB using tools designed to work with MongoDB doesn't necessarily mean that CosmosDB will return the correct result.
If you require a cloud-based MongoDB deployment, using MongoDB Atlas is likely the best solution at this point in time.
Finally I could solve this problem by myself.
The latest version (v3.1.1) of the library doesn't work for connecting to Azure Cosmos DB.
You should use mongodb 2.2.33.
I found the solution from a comment on https://learn.microsoft.com/en-us/azure/cosmos-db/mongodb-samples.
I'm using tedious to connect to SQL Server and run queries from node.js. One of my queries includes the following: FROM App.fnSplit ('111,222,333,444', ',').
But it's throwing the following error: Invalid object name 'App.fnSplit'.
This works in the Java application that I'm converting to Node.js and also works from RazorSQL client. Is there any library that I need to include to get this working? Thanks in advance.
When I Create the azure database with Entity Framework model first pattern, then the creation works. But when I want to save the database I get the following error:
"Tables without a clustered index are not supported in this version of SQL Server. Please create a clustered index and try again."
I updated entity Framework to Version 6.1.2. But still get the same eroor. Do you have any idea?