mlab

Unable to connect to MongoLab “auth fails” error

徘徊边缘 提交于 2019-12-03 01:20:37
I am new to mongo. Recently created an account in mongoLab. I am trying to connect to the database using the below statement. mongo ds039487.mongolab.com:39487/webbies -u <dbuser> -p <dbpassword> Getting the below error MongoDB shell version: 2.4.8 connecting to: ds039487.mongolab.com:39487/webbies Wed Dec 11 22:30:16.686 Error: 18 { code: 18, ok: 0.0, errmsg: "auth fails" } at src/mongo/shell/db.js:228 exception: login failed Note: dbuser - is an User created in mongoLab What is missing in this? Kindly advice. Old thread, but just in case it helps anyone else: my problem was using shell

MongoLab/PyMongo connection error

こ雲淡風輕ζ 提交于 2019-12-03 01:18:00
If I run in the shell: mongo ds0219xx.mlab.com:219xx/dbname -u user -p pass It works and allows me to connect to the database and pull information. But if I'm within my python application (Flask) and run this: import pymongo client = pymongo.MongoClient("mongodb://user:pass@ds0219xx.mlab.com:219xx/dbname") db = client["dbname"] db.users.insert_one({ "user1": "hello" }) It gives me an: pymongo.errors.OperationFailure: Authentication failed. I'm pretty sure it's failing before it gets to the insert_one() call, but I'm not completely sure. Thanks! Edit: By request, here is the full callback:

Searching json object key containing value, then unset it

依然范特西╮ 提交于 2019-12-02 11:58:51
问题 I'm looking for a way to search a JSON object to check if it contains a given value, and if it exists, then unset it. My data is structured as follows (commented with explanation): // Search within the 'seats' array for a given 'guestID', if it exists, unset it tables = [ { "_id":{ $oid: "one" }, "seats":[ { "guestId":"01" }, { "guestId":"02" }, { "guestId":"03" } ] }, { "_id":{ $oid: "two" }, "seats":[ { "guestId":"11" }, { "guestId":"12" }, { "guestId":"13" } ] } ] I am using underscore for

How can I use the mongolab add-on to Heroku from python?

浪尽此生 提交于 2019-12-02 00:04:20
The documentation only talks about how to do it from ruby. This is Will from MongoLab. We have a generic example of how to connect in Python using the official python driver (pymongo). This example is not for connecting from Heroku per say but it should be similar. The difference is that you will need to pluck your driver config from your Heroku ENV environment to supply to the driver. https://github.com/mongolab/mongodb-driver-examples/blob/master/python/pymongo_simple_example.py If you still have trouble feel free to contact us directly at support@mongolab.com -will I'm using the following:

How to subtract two date time in mongodb

故事扮演 提交于 2019-12-01 23:18:34
问题 I have used aggregate function. db.checkins.aggregate([ {$match: {checkinType: "Beacon", "associationIds.organizationId":"af39bc69-1938-4149", "checkinData.time": {"$gte": new Date("2018-01-18T18:30:00.000Z"), "$lt": new Date("2018-01-19T18:30:00.000Z")} } }, {"$sort":{"checkinData.time":-1}}, {$group: {"_id": {"orgId":"$asst.organizationId", "userId":"$asst.userId"}, "lastSeen":{"$first":"$checkinData.time"}, "firstSeen":{"$last":"$checkinData.time"}, } }, {"$project":{"_id":1,"lastSeen":1,

MONGODB [DEBUG] cursor.refresh() for cursor 7078636577051629992

故事扮演 提交于 2019-12-01 14:26:42
While updating a big json list, I'm getting the following error : 2012-04-01T09:34:00+00:00 app[run.1]: MONGODB [DEBUG] cursor.refresh() for cursor 7078636577051629992 2012-04-01T09:34:00+00:00 app[run.1]: the server responded with status 404 2012-04-01T09:34:00+00:00 app[run.1]: rake aborted! That seems to say: in consequence of cursor.refresh() I get a time out then the server 404 responce Mongodb is currently running on Heroku/MongoLAB but on my local machine I've not this behaviour. You have answer on Google group of Mongoid by Durran Jordan ( Mongoid's creator ) ( https://groups.google

application times out when connecting to MongoLab from Heroku

核能气质少年 提交于 2019-12-01 13:03:26
I am hosting a node.js application on Heroku and trying to connect to MongoLab using the node module node-mongodb-native to connect. My application works fine when run from localhost connecting to MongoLab, but after deploying to Heroku I get an Application Error H12 (Request timeout). Sample code: app.get('/', function(req, res) { require('mongodb').connect(mongourl, function(err, conn){ conn.collection('mycollection', function(err, coll){ coll.find().toArray(function(error, results) { if(error) console.log(error) else { res.send(util.inspect(results)); } }); }); }); }); Are there additional

MONGODB [DEBUG] cursor.refresh() for cursor 7078636577051629992

☆樱花仙子☆ 提交于 2019-12-01 12:14:52
问题 While updating a big json list, I'm getting the following error : 2012-04-01T09:34:00+00:00 app[run.1]: MONGODB [DEBUG] cursor.refresh() for cursor 7078636577051629992 2012-04-01T09:34:00+00:00 app[run.1]: the server responded with status 404 2012-04-01T09:34:00+00:00 app[run.1]: rake aborted! That seems to say: in consequence of cursor.refresh() I get a time out then the server 404 responce Mongodb is currently running on Heroku/MongoLAB but on my local machine I've not this behaviour. 回答1:

Connect to MongoDB database using mongoose behind a proxy

心已入冬 提交于 2019-12-01 04:16:59
I am using mongoose to connect to my database in mongolab in my server.js file : mongoose.connect('mongodb://MyUsername:MyPassword@ds089702.mongolab.com:89702/todo'); When i launch my server with node server.js command, i see this error in my terminal failed to connect to [ds089702.mongolab.com:89702] I am very sure that is just a corporate proxy problem, so I'm wondering how can I connect to my database over the corporate proxy using mongoose ? Thank you! I had the same problem and figured out a solution that worked for me. Example mongodb URI: mongodb://:@ds123456.mlab.com:37409/dbName Use a

Unable to connect to mongolab, Getting MongoError: auth failed

本秂侑毒 提交于 2019-11-30 10:59:20
问题 I have recently created an account in mongoLab.When I am trying to connect to the database using the below statement. var mongoose = require('mongoose'); mongoose.connect('mongodb://mk:12345@ds047742.mongolab.com:47742/mkdb'); I'm always getting the following error MongoError: auth failed at Function.MongoError.create (/Users/a042292/Desktop/start/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/error.js:31:11) at /Users/a042292/Desktop/start/node_modules/mongoose/node