1
vote
0answers
13 views

ReferenceError: client is not defined Node.js Mongodb

I am creating a client management system and I am using a RESTful approach to create a dash board or sorts. But, unfortunate I am getting an error in terminal when trying to start a node server that ...
0
votes
1answer
22 views

Adding values to mongodb by using Linux shell script

Here im trying to push some values to mongodb this is my pseudo code while read LINE do addRow $para1 $param1 #pass value to the mongo done < ${FILE} function ...
0
votes
0answers
17 views

get average value of field in all documents

my Task model have a number named "process_time", i'm trying to get average value fo all docs Task.aggregate([ { $match: { } }, { $group: { process_time: { $avg: 1} }} ], function ...
1
vote
0answers
26 views

Slow insert and update in mongo using node.js as compared to Java

I am writing stand alone script to insert some 5000 records in a collection. I am updating another collections using the same 5000 records. My issue is when i write this using java with mongo it takes ...
0
votes
0answers
15 views

Multiple document update trough single document update query in a loop

I'm building an app in Node/Express/MongoDB with Mongoskin. In this app, there is a scheduled function, that runs at the beginning of every month. This function consist of the following code: ...
0
votes
1answer
15 views

Mongodb native driver ,connection string error

I made a sandbox at mongolab.com and I am running server on local machine . When I compile the "app.js" file var uri='mongodb://inyourpc:[email protected]:47198/fairywayrpg'; ...
-1
votes
0answers
16 views

Use of Node , Python , NLTK , real time processing

For the first time i am trying to help setup the architecture of a system that needs to handle millions of tweets , provide real time response and also perform some natural language processing. I ...
0
votes
2answers
24 views

Mongoose sort by child value

I have a parent and child schema that looks like: schedule = Schema ({ from: Date, to: Date }; content = Schama ({ schedule: { type: Schema.ObjectId, ref: "schedule" } name: String ...
1
vote
0answers
21 views

What is your strategy for managing payload validations, defaults in an API? [on hold]

I'm building a new RESTful API and I'm curious to know what strategies you employ to validate and ensure schema parity in payloads between your database, API, and client. If it helps/matters, this is ...
1
vote
0answers
17 views

Stream from a mongodb cursor to Express response in node.js

I am toying around with all the fancy node.js/mongodb/express platforms, and stumbled across a problem: app.get('/tag/:tag', function(req, res){ var tag=req.params.tag; console.log('got tag ' + ...
0
votes
0answers
17 views

update/extend mongoose document with object

I have a REST api client that I send and receive mongoose documents to as plain objects, serialized via JSON. The documents arent overly complex, but do contain embedded objects and arrays, like: var ...
-1
votes
1answer
29 views

MongoDB couldnt connect to server 127.0.0.1:27017

This is a picture of the response it is giving me. I cannot copy cmd stuff for some reason = ( Please let me know if you need more info. I figure it is something sort of trivial. This is so foreign ...
0
votes
1answer
12 views

Passport Profile not passing new properties

I'm using Passport OAuth2.0 with Google as my provider, and having a weird syntax problem. My authentication looks like this: passport.use(new GoogleStrategy({ clientID: GOOGLE_CLIENT_ID, ...
0
votes
1answer
22 views

How to change json value in mongoose

i'm development nodejs and mongoose. make schema example birth: {body:Date, visible:Boolean} and query this. var data; schema.where('_id').equals(userId).exec(function(err, docs){ data.birth ...
0
votes
0answers
14 views

how to close the mongodb connection without generating journal files when close the node.js app

My node.js based app connects to a mongodb database, when I manually close the node.js app, it will trigger the function below to close the mongodb connection. // Process on exit and signals. ...
1
vote
2answers
45 views

How to create a dynamic front end based on Node JS, MongoDB, Sails JS

Basically I'm writing an app and am using Sails, MongoDB and Node JS for the back end. I'll use Sail's API features and was wondering what would be the best way to make the app realtime. For ...
0
votes
2answers
41 views

writing node.js api callback or not

Folks, Assume an API written in NodeJS (restify.js) that utilizes a NOSQL backend (mongo or dynamo). When you have a blocking operation, such as reading or writing to a file, its always a great ...
0
votes
0answers
25 views

How to link to sub-document using mongoose & node.js

Is it possible using Node.js, Express and Mongoose for MongoDB to have a link to a sub-document. He is one of my document containing platforms sub-Documents: // A product description { "name": ...
1
vote
1answer
18 views

Handle mongodb connection in expressJS

im using expressJS and mongoDB and I try to persist my mongodb connection opened in one place to whole app. How should I do it? I dont want to open it every time in my every route/model file, which ...
1
vote
1answer
22 views

mongoose unable to find refs using $in operator

I have a user schema like this var userSchema = new mongoose.Schema({ username: String, following: [{created: {type: Date, default: Date.now}, target: { type: mongoose.Schema.Types.ObjectId, ref: ...
0
votes
0answers
27 views

How can I save an empty array into mongodb using js

Basically I got my app up an running but I'm stuck with a problem: if I pass an object that contains an empty array to be saved, the array is not saved into the db. I'm not sure this is a problem in ...
-1
votes
0answers
19 views

MongoDb:how to find a sub doc and push data into it

i have an account schema ,reciever schema and message schema.message Schema is a sub doc of reciever schema and reciever schema in turn is a sub doc of account schema. i want to push some data into ...
0
votes
0answers
28 views

Ember, Ember Data, MongoDB _id and namespace

I'm new to Emberjs and I'm developing Nodejs /Express/ app with MongoDB and Ember. According to this blog post I added primaryKey, serializerId to my extended adapter. window.Frontend.Adapter = ...
0
votes
0answers
21 views

Display image with node from mongodb gridfs

the code below does work in firefox, but not in IE / Chrome, where the node app crashes with message "metadata unknown". var http = require('http'), url = require('url'), path = ...
0
votes
1answer
29 views

MongoDB is not producing output with Node.js

I am having trouble getting the output of a MongoDB query. When I call the save method: db.users.save({email: "[email protected]", password: "test", sex: "male"}, function(err, saved) { }); ...
1
vote
2answers
20 views

Converting object returned by MongoDB into bar?

I think this is a very simple question? I am a beginner trying to learn mongo with node. Once I have saved something to a collection, how can I pull it out in simple var format? ...
0
votes
0answers
27 views

RESTFUL crud modeling in nodejs and express using mongo

What is the best way to go about this. I am using express and mongoose with mongodb. My site will have generators that users can submit. Right now I am not validating the names of the generators to ...
-1
votes
1answer
29 views

MongoDB multiple/single collection and MySQL advice [on hold]

I have a project which is using NodeJS and I have different entities for example, people and places. I need the ability to find both types of entities by location together so what I was thinking of ...
0
votes
1answer
28 views

Schema hasn't been registered for model. Mongodb>Mongoose

Hi my code is shown below: var mongoose=require('mongoose'); mongoose.connect('mongodb://localhost/test'); var Schema=mongoose.Schema , ObjectId=Schema.ObjectId; var BlogPost= new Schema({ ...
0
votes
2answers
27 views

Node.js, socket.io and mongojs - Login form with socket.io

I am currently creating a small chat application on node.js using mongojs, I have a mongo collection of users with a username, password and name fields. The application uses socket.io to send the data ...
0
votes
1answer
19 views

Looping through Mongo Results in NodeJS and adding field or using virtuals

I'm somewhat new to Node and MongoDB and I'm running into a really odd problem. I'm trying to add a new field to a json being printed out from a MongoDB. But for whatever reason, it doesn't show up. ...
0
votes
0answers
35 views

RestFul Api Node.js & Mongoose: handling errors

I want to create a restful API with Node.js, Express, MongoDB and Mongoose. Schema, model and route are below: // Schema var OperatorSchema = new Schema({ name : { type: String, unique: true , ...
0
votes
1answer
27 views

How do I merge 2 subproperties in MongoDB?

I have 2 subproperties of a document and want to move all properties from one to another, but AFTERWARDS I want to erase the empty property. Now I know the $rename command can be used to move each ...
0
votes
1answer
38 views

sending data from Javascript to save in mongoDB through nodejs

I am trying to parse an object from a javascript (a blog post head and body) through a node.js server and on to save it in the mongoDB. this is the parsing code: function saveState( event ) { ...
0
votes
1answer
25 views

What is difference between GeoJSON & Legacy coordinate pairs in terms of mongoDb?

I am trying to use $geoNear aggregation operator of mongoDb to calculate distances of users from current location in following way : '$geoNear': { near: currentLocation, distanceField: ...
0
votes
1answer
15 views

Node.js check mongoose validation and alert user

Hello I am using mongoose with the mongoose uniqure validator which is a module for easy mongoose validation. I'd like to know the best way to go about this: when a user tries to submit a ...
0
votes
2answers
39 views

mongodb crashed node with exception within try catch

try p = req.params.name Item.update('name': p, req.body , {upsert: true}, (err) -> if err? throw err res.send("ok") ) catch e handle_error(e, "Error salvando ...
0
votes
1answer
23 views

Removing many to many reference in Mongoose

One of my mongoose schemas is a many to many relationship: var UserSchema = new Schema({ name : String, groups : [ {type : mongoose.Schema.ObjectId, ref : 'Group'} ] }); var GroupSchema ...
0
votes
1answer
23 views

My express application could not connect to mongodb

Hi i connect my mongodb with command prompt on windows. But i could not with express application. I read too many blog post about node,express and mongodb but could not find the problem. So i need ...
1
vote
1answer
46 views

What's going on with Meteor and Fibers/bindEnvironment()?

I am having difficulty using Fibers/Meteor.bindEnvironment(). I tried to have code updating and inserting to a collection if the collection starts empty. This is all supposed to be running ...
0
votes
0answers
34 views

Mongoose not returning count from mongo db

Previously we were using the mongoose version [email protected] . In that for getting the count of matches for a particular filter criteria , we were using the following count function present in ...
1
vote
1answer
27 views

How to return only values instead of key:value pairs from mongodb in nodejs

When searching a collection on some field, I can specify that I only want returned certain fields. In the case of only returning one field, let's say "_id", the find command returns an array of ...
0
votes
1answer
21 views

model.count not a reliable test of existence for fast asynchronous writes

Before saving a new document to a mongodb collection via nodejs in my MongoLab database, I'm using model.count to check certain fields to prevent a duplicate entry: MyModel.count({field1: criteria1, ...
0
votes
0answers
9 views

How can I get the nr of properties in a document's property in MongoDB?

The question is pretty simple. I have an object as a property of a document, with a variable nr of properties, and I want to get the number of them, without having to get the entire object worth of ...
1
vote
1answer
42 views

Schema for User table with multi strategy sigup

While working on one project faced with problem of storing user information for different passport strategies(local, facebook, twitter). At the begining my UserSchema had such look: User = ...
0
votes
1answer
46 views

mongoose population ignores options

I'm having trouble understanding the population logic of mongoose. I have a UserSchema which holds an array of articles. articles: { type: [{ article: { type: ...
0
votes
2answers
45 views

node.js: Throwing error and it's not being caught

I have an API using swagger integrated with express on node.js and a resource defined as below. A swagger error thrown in the check for (!req.params.id), is caught by swagger's default error handler. ...
1
vote
0answers
92 views

MongoDB Aggregation Framework performance slow over millions of documents

background Our system is carrier grade and extremely robust, it has been load tested to handle 5000 transactions per second, and for each transaction a document is inserted into a single MongoDB ...
0
votes
1answer
20 views

Heroku + MongoHQ + NodeJS

I'm working on an app using MongoHQ to store a user database, and according to Heroku this is causing it to crash- app/web.1: [Error: failed to connect to [MONGOHQ_URL:27017]] I'm 90% sure it's ...
0
votes
1answer
27 views

How to convert year as string format in nodejs?

I want to get the year as in the string format. How to convert output of query collection.find({ $and: [ { year : { $gte: 1900 } }, { year: { $lte : 1942 } } ] } ) to get it as string?

15 30 50 per page