I am a programmer but I hate grammar. Here you will find what I did, doing , will do ... Scattered pieces of knowledge that I have deleted from my mind to the trash bin through out my boring daily coding life. I will also report some of my failures in life so dear to me not success, because I have always learnt much only when I fail.
Friday, April 8, 2016
Wednesday, April 6, 2016
trying to open unclosed connection
When having the error, the first thing to do is to restarting your mongo database.
If the error still persist, chances are that your connection statement is as below:
var dbUrl= 'mongodb://localhost:27017/test';
mongoose.connect(dbUrl);
To solve it , change connect to createConnection
var dbUrl= 'mongodb://localhost:27017/test';
mongoose.createConnection(dbUrl);
It should be working now, if not drop me a comment and will come to your rescue...
If the error still persist, chances are that your connection statement is as below:
var dbUrl= 'mongodb://localhost:27017/test';
mongoose.connect(dbUrl);
To solve it , change connect to createConnection
var dbUrl= 'mongodb://localhost:27017/test';
mongoose.createConnection(dbUrl);
It should be working now, if not drop me a comment and will come to your rescue...
Monday, March 14, 2016
TypeError: require(...).connect is not a function
I recently had a hard time trying to fix this issue.
I initially wrote these lines below to establish my connection:
var databaseUrl = "localhost/school";
var collections = ["student", "professor"]
var db = require("mongojs").connect(databaseUrl, collections);
var http = require("http");
Now it seems that since 1.x , mongojs no longer support the connect function,
instead we should replace the third line with:
var db = require("mongojs")(databaseUrl, collections);
Source: https://github.com/mafintosh/mongojs/issues/286
I initially wrote these lines below to establish my connection:
var databaseUrl = "localhost/school";
var collections = ["student", "professor"]
var db = require("mongojs").connect(databaseUrl, collections);
var http = require("http");
Now it seems that since 1.x , mongojs no longer support the connect function,
instead we should replace the third line with:
var db = require("mongojs")(databaseUrl, collections);
Source: https://github.com/mafintosh/mongojs/issues/286
the default storage engine 'wiredtiger' is not available issue solved
I have created my data/db in the bin folder, for more about the installation watch this tutorial
Now to start mongod, instead of :
mongod --dbpath ./data/db
Do this instead:
mongod --storageEngine=mmapv1 --dbpath ./data/db
Hope it helps:
Now to start mongod, instead of :
mongod --dbpath ./data/db
Do this instead:
mongod --storageEngine=mmapv1 --dbpath ./data/db
Hope it helps:
mongodb unclean shutdown detected
Are you having this error message : mongodb unclean shutdown detected ?
In my system I have my data/db under the bin folder
if you are using linux :
In my system I have my data/db under the bin folder
if you are using linux :
sudo rm /data/db/mongod.lock
sudo mongod --dbpath /data/db --repair
sudo mongod --storageEngine=mmapv1 --dbpath ./data/db
if you are using windows:
Go to your data/db directory:
1. delelte mongod.lock file
2.mongod --dbpath ./data/db --repair
3. mongod --storageEngine=mmapv1 --dbpath ./data/db
More about the issue here
Subscribe to:
Posts (Atom)