I can't use RockMongo(v1.1.2) to connect MongoLab, what did i do wrong?
In my MDb.php file
$MONGO["servers"][$i]["mongo_name"] = "MongoLab";
$MONGO["servers"][$i]["mongo_host"] = "ds053xx.mongolab.com";
$MONGO["servers"][$i]["mongo_port"] = "53818";
$MONGO["servers"][$i]["mongo_timeout"] = 0;
$MONGO["servers"][$i]["mongo_auth"] = true;
and when I log in with my username, password, db_name
It can log in but I can't do anything with it
on the left side of the screen it show
Execute failed:unauthorized
function (){ return db.getCollectionNames(); }
I have no problem when connect to local database.
And also can use the same url,port,username,etc. with MongoVUE
This doesn't appear to be anything you're doing wrong. It looks like RockMongo requires admin access because it's trying to list collections for databases other than your own (such as the admin and local databases), which is not possible w/ MongoLab's Sandbox databases.
https://github.com/iwind/rockmongo/issues/35
If you want to access only your own database, you can change the following line 31 inside rockmongo/apps/models/MDb.php listCollections(MongoDB $db) function:
from
$names = self::exec($db, 'function () {
return db.getCollectionNames();
}');
to
$names = $db->getCollectionNames();
Related
[2018-05-16 08:27:12.979] [ERROR] server - Pipe
postgres://xnmcmqfirrdzkg:638d94fcd7aa5178e1054f0ff604613826033d5e8845fb42614c17a3d386823a#ec2-107-21-126-193.compute-1.amazonaws.com:5432/d5l5g60nk6l27a
requires elevated privileges
I'm trying to deploy server Express + Sequelize + Postgres on Heroku.
if (config.use_env_variable) {
var sequelize = new Sequelize(process.env[config.use_env_variable]);
}
else {
config.logging = function (str) {
log4js.getLogger("sequelize").info(str);
}
var sequelize = new Sequelize(config.database, config.username, config.password, config);
}
The data's credential is set at default. I tried searching on the internet but there is no one having the same problem with me.
I am. But I have not been able to figure it out yet. And the docs I have been provided are more than two years old.
Connects without a hitch, but on insert() throws me this error.
var MongoClient = require('mongodb').MongoClient;
const assert = require('assert');
var url = 'mongodb://____:____#ds125565.mlab.com:25565/heroku_w268n9pj';
MongoClient.connect(url, function(err, client) {
assert.equal(null, err);
db = client.db('temp');
console.log("connected!");
const collection = db.collection('temp');
collection.insert([{
something: please
}
});
I saw some other answers regarding mLab accounts and credentials, but I just created a new admin account for this. Frustrating because it was working previously with v2.3.
When attempting to connect to an mlab database, you have to correctly specify the client. It's located at the end of your connection string, just after the final forward slash.
mlab_url = "mongodb://db_user_name:db_password#ds139725.mlab.com:39725/heroku_sd1fp182?retryWrites=false"
client = MongoClient(url)
db = client["heroku_sd1fp182"]
collection = db["coinHack"]
You may also get the error:
This MongoDB deployment does not support retryable writes. Please add retryWrites=false to your connection string.
Just add "?retryWrites=false" to your connection string, as shown above.
I have set up auth in my MongoDB as mentioned here. Initially, in my project I was accessing a single database say, firstdb from mongoose using
let url = "mongodb://localhost:27017/firstdb";
let options = {
server:{
socketOptions:{
keepAlive:120
}
},
user:"username1",
pass:"mypassword1"
};
mongoose.connect(url,options,callback);
The user with username and mypassword was created in the firstdb itself giving it readWrite perms. I did this while logged in with my admin user.
Things were working smoothly. Then I had a requirement of connecting to a second database. So I changed my code as such
let url1 = "mongodb://localhost:27017/firstdb";
let options1 = {
server:{
socketOptions:{
keepAlive:120
}
},
user:"username1",
pass:"mypassword1",
auth:{
authdb:"firstdb"
}
};
let connection1 = mongoose.createConnection(url1,options1);
let url2 = "mongodb://localhost:27017/seconddb";
let options2 = {
server:{
socketOptions:{
keepAlive:120
}
},
user:"username2",
pass:"mypassword2",
auth:{
authdb:"seconddb"
}
};
let connection2 = mongoose.createConnection(url2,options2);
This time I created user username2 the same way in the seconddb database. But now mongoose is unable to perform any operation and is failing with Not authorized to execute command. I can access the db through mongo shell though. I also spun up the code in my local system which doesn't have mongodb auth enabled and it works fine there. Please help
So, after shooting around in the blind, found something that works.
Use the username and password in the url itself like
let connection1 = mongoose.createConnection("mongodb://username1:password1#localhost:27017/firstdb");
Still, I would like to know why passing the parameters as options doesn't work.
My question is this: How can I remove a user from the users db by username, or at all even?
I have a meteor application with a custom registration, and when an account is created you can login and manage your account and what have you.. My problem is that, on the local host for testing, I created a few extra user accounts that I want to delete individually (not a complete reset). I am on OS X so I went to terminal, typed in 'show dbs' but users came up empty and when I typed 'show users' nothing came up. If I type 'db.users.findOne()' information appears and I can get a username and _id. I know there is users and this command shows that there is at least one but the rest of the commands indicate that I can't manage them.
Below is some code for the registration page, specifically the Accounts.createUser I'm not sure it will mater for the response but I wanted to be thorough.
Template.SignUp.events({
'submit form': function(event, template){
event.preventDefault();
var UsernameVar = template.find('#username').value;
var emailVar = template.find('#Email').value;
var passwordVar = template.find('#password').value;
var ConfirmPasswordVar = template.find('#Cpassword').value;
if(ConfirmPasswordVar == passwordVar)
{
document.getElementById("NotValid").style.display = 'none';
Accounts.createUser({
username: UsernameVar,
email: emailVar,
password: passwordVar
}, function(err, result){
if(err)
{
document.getElementById("Unavailable").style.display = 'block';
}
else{
document.getElementById("Unavailable").style.display = 'none';
}
});
}
else{
document.getElementById("NotValid").style.display = 'block';
}
}
});
I've done a lot of searching on this issue and all I've found is how to grant users the right to remove profiles but I want to do it from terminal, even when the application launches I will be the only one to be using this feature so I don't want to start giving those rights to users.
If there is anything else I should provide please let me know.
meteor mongo
db.users.find({username: "someusername"}) // ensure that your query returns the correct user that you want to remove
db.users.remove({username: "someusername"})
I have a simple Meteor/MongoDB project using the 'roles' package where I optain data from the db to the client. The roles package seems to work fine and the browser shows the right data depending on who is logged in, just like it should do. Then when running 'meteor remove autopublish' in the terminal inside my applications directory I get 'autopublish removed' just like it should. Still I can retrieve data from the server just as before(!?)
I have all of my db calls from the client/client.js.
The server/server.js does nothing (I do have publish/subscribe code but uncomment for now) and same goes for the common js file in main directory.
How can this be? Am I perhaps retrieving data from minimongo somehow? I have also removed insecure even if I don't think that matters in this case(?) Thanks in advance.
EDIT: Here's the code:
client.js:
//when uncomment the subscribe's you should not get access to the server/db, but 'data' that holds all the inlogg info still shows. The 'movies' on the other hand doesn't, just like it shouldn't.
//Meteor.subscribe('data');
//Meteor.subscribe('movies');
/*############# Get User Data ###############*/
Template.userLoggedIn.id = function () {
return Meteor.userId();
};
Template.userLoggedIn.email = function () {
var email = Meteor.users.findOne({_id: Meteor.userId()});
return email.emails[0].address;
};
Template.userLoggedIn.profile = function () {
var profile = Meteor.users.findOne({_id: Meteor.userId()});
return profile.profile.name;
};
Template.userLoggedIn.role = function () {
var role = Meteor.users.findOne({_id: Meteor.userId()});
return role.roles[0];
};
/*############# ###############*/
Template.movies.movies = function() {
var movies = Movies.find().fetch();
return movies;
}
server.js:
Meteor.publish('data', function () {
return Meteor.users.find();
});
Meteor.publish('movies', function() {
return Movies.find();
});
Thanks for providing the code - I see how this could be confusing. The users section of the docs should be written to explicitly say this, but what's happening is the current user is always published. So even if you don't write a publish function for users (or your have your subscribe commented out), you should expect to see the current user on the client. Because your template code only looks for Meteor.userId(), I would expect it to still work.
Assuming you have other users in the database, you can quickly check that they are not being published by running: Meteor.users.find().count() in your browser console. If it returns 1 then you are only publishing the current user (or 0 if you are logged out).