mlab

2-line NodeJS application crashes on mongoose.connect() while trying to connect to a mongolab MongoDB database

我的梦境 提交于 2019-12-13 08:41:27
问题 I have the following NodeJS code: var mongoose = require('mongoose'); mongoose.connect('mongodb://dev:dev@ds031632.mongolab.com:31632/mongodev'); And upon running it with node server.js , it hangs up for a few seconds and throws the following: C:\Users\dev\work\code\local\nodejsplayground\restwithmongo\nod dules\mongoose\node_modules\mongodb\lib\server.js:228 process.nextTick(function() { throw err; }) ^ Error at Object.<anonymous> (C:\Users\dev\work\code\local\nodejsp round\restwithmongo

Parse to Heroku migration (MongoLab): PFRelation issue

烈酒焚心 提交于 2019-12-13 05:33:23
问题 I succeeded to migrate parse to parse-server with mongolab. Now everything works as expected, except when I'm logging with PFUser with MongoLab, my PFRelation object is always null. In my AppDelegate, when I run this code (official Parse): [Parse setApplicationId:@"xxxxxx" clientKey:@"xxxxxx"]; [PFUser enableRevocableSessionInBackground]; HomeView.m: self.currentUser = [PFUser currentUser]; self.friendsRelation = [[PFUser currentUser] objectForKey:@"friends"]; NSLog(@"%@", self.currentUser);

$set in MongoDB : Not working as intended

安稳与你 提交于 2019-12-13 04:07:48
问题 I have the following document in my DB : { .... "key": "val1", .... "array" :[ { "k":"v1", "rejected":"0" }, { "k":"v2", "rejected":"0" } ] ..... } Now basically I want to set "rejected":"1" for ("key":"val1" && array[i]."k":"v1" ). The API call that I have written is : var val1="val1"; var v1="v1"; request.put('https://api.mlab.com/api/1/databases/DB/collections/doc?q={"key": "'+val1+'","array.k":"'+v1+'"}&apiKey=.....', { json: { "$set": {"rejected": "1"} } }, function (error, response,

(How) can aggregate() break an index?

拜拜、爱过 提交于 2019-12-13 03:58:46
问题 (How) can this code break an index on a MongoDB collection? db.users.aggregate([ { $group: { _id: null, total_orders: { $sum: { $size: "$orders" } } } }, ]) This is (obviously) trying to count all the orders of all the users. I have inherited a project with this code commented out. I need to uncomment (re-enable) the code, but would like to understand what I risk by doing so. The author of this change is unavailable, and their commit message for the commenting out is "remove statistics calls

Mongoose findOneAndUpdate: create and then update nested array

混江龙づ霸主 提交于 2019-12-13 03:45:08
问题 I have a program where I'm requesting weather data from a server, processing the data, and then saving it to an mlab account using mongoose. I'm gathering 10 years of data, but the API that I'm requesting the data from only allows about a year at a time to be requested. I'm using findOndAndUpdate to create/update the document for each weather station, but am having trouble updating the arrays within the data object. (Probably not the best way to describe it...) For example, here's the model:

fullText is not working in Parse Server with Mlab [closed]

ⅰ亾dé卋堺 提交于 2019-12-13 03:41:32
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 15 days ago . I am running parse server(2.8.4) on heroku with Mlab. I a trying to search based on word match but the fullText throwing an error,here is my query: var query1 = new Parse.Query("SearchTerms"); query1.fullText("searchString", "programmer"); It throwing below error: ParseError {

MongoError: socket hang up

不想你离开。 提交于 2019-12-12 09:14:48
问题 I am trying to connect to the mongodb database on mongolabs(mlabs). I connect successfully when I run the code on my local computer and server.But When I run on my aws server I get this error database error { [MongoError: socket hang up] name: 'MongoError', message: 'socket hang up' } Code trial.js: var express = require('express'); var app = express(); var mongoose = require('mongoose'); var mongojs = require('mongojs'); var db = mongojs('mongodb://user:pass@ds01312192.mlab.com:133492

connecting mlab database with pouchdb

我的梦境 提交于 2019-12-12 02:21:58
问题 I'm trying to build an application which sync between offline and online,its working with cloudant and pouchdb,i want to use mlab instead of cloudant here is my code: this.db = new PouchDB('cloudo'); this.db = new PouchDB('cloudo'); this.username = ''; this.password = ''; this.remote = 'https://oussemalaamiri.cloudant.com/museums/'; 来源: https://stackoverflow.com/questions/43253097/connecting-mlab-database-with-pouchdb

How to handle mongo db unable to connect issue with Mongoose and NodeJs?

帅比萌擦擦* 提交于 2019-12-11 21:26:39
问题 Our Nodejs application uses Mongoose for MongoDB. Our application crashes when it unable to connect to MongoDB database. We are using MongoLab . What are the best ways to handle database connect issue in Node JS application? 回答1: Just handle error with the associated events: // If the connection throws an error connection.on('error',function (err) { // Do something here }); // When the connection is disconnected connection.on('disconnected', function () { // Do something else here }); And, of

Getting error while running command heroku ps:scale worker=1 error

百般思念 提交于 2019-12-11 18:57:43
问题 I tried a lot but not able to find the reason for this. Need help. Following is what I am writing after deploying my first node app in Heroku and my DB is at MongoLab heroku ps:scale worker=1 It is giving me following error. ! No such type as worker. My Procfile look like this, web: node server/server.js Here is my log file look like 2013-04-20T21:12:31.474207+00:00 app[worker.1]: at startup (node.js:119:16) 2013-04-20T21:12:31.474207+00:00 app[worker.1]: at node.js:901:3 2013-04-20T21:12:32