Having trouble with Matlab 'executeCypher' command - matlab

I established connection with my Neo4j graph database:
neo4jconn = neo4j(url,username,password);
checked that the connection is working:
neo4jconn.Message
ans =
[]
But when I try to query the database using Cypher:
query = 'MATCH(m:Nutrient) RETURN m';
results = executeCypher(neo4jconn, query)
I get the following error message:
Error using database.neo4j.Neo4jConnect/executeCypher
Cannot execute Cypher(R) query.
When I use the same query command in Neo4j browser I get the result which I need.

My problem was in the 'url' variable. When I start Neo4j it opens in the browser at: 'http://localhost:7474/browser/'. I created a new subdirectory /Neo4j/fiadb to store nodes/relationships of my database. And I used the following url for the Matlab 'neo4jconn = neo4j(url,username,password)' command:
url = 'http://localhost:7474/browser/fiadb'
This proved to be the right path:
neo4jconn.Message
ans =
[]

Related

Running dumps in query runner

I had a project which was unfortunately being developed only using the synchronize: true option until now.
I decided to change it and what i did was create a dump and then ran it in the query runner. and found myself stuck in an error.
I did something like : [Database = postgres , ORM = typeorm]
pg_dump db > db.sql
this created a sql file i copied it's content and pasted in query runner which gives me an error like:
driverError: error: syntax error at or near "."

MongoDB - A Script to Create Indexes

New to MongoDB - at the moment I'm creating indexes directly from my web app however I want to instead have some sort of bash script I run (and more easily maintain) that can create my various text indexes for me.
Wanted to check is this possible? I'm unsure about how I would actually execute it if so - namely I have a Docker image running Docker - so do I have to bash into that then run the .sh? Or would I just specify the DB and collection in the script itself and just run it from terminal as usual?
Any pointers would be appreciated.
Thanks.
You can do it using java script:
var createIndexes = function(fullObj) {
conn = new Mongo();
db = conn.getDB(databaseName);
getMapInd = null;
setMapInd1 = db.testMappings.createIndex( { 'testId': 1}, {unique: true} )
getMapInd = db.testMappings.getIndexes();
printjson("---------------------Below indexes created in Mappings collection-----------------------");
printjson(getMapInd);
};
createIndexes();

Error 20599 Cannot open SQL Server using VB6/Crystal report

I have been trying to browse a SQL Server database-based Crystal Reports version 8 with following Visual Basic code:
CrystalReport1.ReportFileName = "C:\Report1.rpt"
CrystalReport1.Destination = crptToWindow
CrystalReport1.DiscardSavedData = True
CrystalReport1.WindowState = crptMaximized
MsgBox "Ok!", vbInformation
CrystalReport1.Action = 1
I am using the Crystal Reports control. The database of the report is ODBC datasource connecting to SQL Server. Without DiscardSavedData this works, but it displays old data. With DiscardSavedData, I get the error message:
Error 20599 Cannot open SQL Server.
How do I solve this problem?
i have solved my issus by adding the connection string CrystalReport1.Connect, i'd like to share my solution for all.
CrystalReport1.ReportFileName = "C:\Report1.rpt"
CrystalReport1.Destination = crptToWindow
CrystalReport1.DiscardSavedData = True
CrystalReport1.Connect ="Data Source=Localhost;UID=sa;PWD=****;DSQ=Dat BdName;"
CrystalReport1.WindowState = crptMaximized
CrystalReport1.Action = 1

MongoDB rename or drop a collection on a SyncClusterConnection

I have a collection I want to drop / rename. I have written the following javascript to do this:
var now = new Date();
var runTime = now.getTime();
var newCollName = "myColl." + runTime;
db.myColl.renameCollection(newCollName);
When I run the script on my single node dev install the drop or rename works fine. However when I try the same command on the real instance which is clustered and uses replicasets I get the following error:
Renaming myColl collection to : myColl.1449761151171
2015-12-10T15:25:55.703+0000 E QUERY Error: write $cmd not supported in SyncClusterConnection::query for:renameCollection
at DBQuery._exec (src/mongo/shell/query.js:83:36)
at DBQuery.hasNext (src/mongo/shell/query.js:240:10)
at DBCollection.findOne (src/mongo/shell/collection.js:187:19)
at DB.runCommand (src/mongo/shell/db.js:58:41)
at DB.adminCommand (src/mongo/shell/db.js:66:41)
at DBCollection.renameCollection (src/mongo/shell/collection.js:642:21)
I've read the mongodb notes for drop and renameCollection, but they dont mention needing to do anything special when running the commands on clustered database.
What do I need to do to archive off a collection on a MongoDB that is structured like this?
thanks.

cannot mongodb console in OSX using mongoose

i am able to run mongodb in my apple console, and vim the mongo.log
right now, i just want to open up the mongodb console so that i can test queries in the console just like the examples in http://www.mongodb.org/display/DOCS/Tutorial
at the moment, the cursor is not returned:
> mongodb
all output going to :/usr/local/var/log/mongodb/mongo.log
and the cursor is not returned. i was expecting the cursor to be returned to so i can do the following :
> mongodb
all output going to :/usr/local/var/log/mongodb/mongo.log
> test = {name : "bouncingHippo"}
> db.family.save(test)
> "ok"
What am i doing wrong? i am using mongoose
I'm not entirely clear which console you are getting this output from, as the Node console won't return anything usable if you just enter mongodb.
If what you are trying to do is just launch a MongoDB console, you will need to first launch the mongod process and then attach to that process with the MongoDB console. The MongoDB console is called mongo. In the simplest test, you can launch mongod from one terminal window and then mongo from another. In the terminal window that is running mongo you can then work through the examples in the tutorial. Your pseudo code would then look like:
MongoDB shell version: 2.2.1
connecting to: 127.0.0.1:18070/test
> test = {name : "bouncingHippo"}
{ "name" : "bouncingHippo" }
> db.family.save(test)
If you are trying to use Mongoose for the pseudo code you have in your question, it would be more like the following from the Node console (assuming Node.js and Mongoose are installed)
var mongoose = require('mongoose');
var db = mongoose.createConnection('mongodb://localhost/test');
var testSchema = new mongoose.Schema({
name: String
})
var Test = db.model('Test', testSchema)
var test = new Test({ name: 'bouncinghippo' })
test.save()