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
19 views

Mongo shell cursor: updated documents get to cursor again

I am trying to iterate through cursor in Mongo shell to update all documents in collection. My aim was to rename some fields in documents, so the code looked something like this: var cursor = ...
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
1answer
39 views

Autocomplete javascript

I have some problem in crating an autocomplete search box. I have a mongodb collection in which there are photos object with name, description, path and so on. Now, I created a route /searchbox, where ...
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 ...
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
0answers
27 views

Piping Javascript output to a custom MySQL table

My setup is as follows: a) I am running Javascript on a set of figures (sourced from MongoDB) in a Linux command line and getting a set of values. b) I have a table setup on the same Linux machine in ...
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. ...
0
votes
0answers
17 views

Howto get any item (Point, LineString, Polygon) within a bounding box in mongodb

I've a problem with a query matching items inside a BoundingBox. How it's possible to match all items of type 2dsphere (GEO JSON)? In this case I only got the data of type Point but the items of type ...
0
votes
1answer
32 views

TypeError when rendering dust.js template

I have a dust.js template that should render a JSON object coming from a mongodb collection. { "author": "Leslie Horn", "title": "An Awesome 132-Cube Ice Tray Exists Because People Are Assholes", ...
0
votes
3answers
53 views

What does template.data._id do in Meteor?

Beginner Meteor/JS question: When associating objects in Meteor I see small line of code that I'm not understanding. For example, post with associated comments. var $body = ...
0
votes
1answer
16 views

Get all items withing a bounding box in MongoDB

I've a problem with a query matching items inside a BoundingBox. I've read in the mongo documentation a lot without success about $box and $geoWithin but can't figure out why the item which is inside ...
0
votes
1answer
39 views

Multi Insert issue in Meteor

First, I know about the way in the Leaderboard example, which is using a loop to do the multi insert. However, when I do this, I get a mongoDB error on the server console, stopping the insert. I ...
3
votes
2answers
278 views

Fixing AngularJS 1.2.0 [$parse:isecprv] errors

AngularJS 1.2.0 just got released, and there's an instant problem for CounchDB and MongoDB users: When trying to access some JSON data preceded by an underscore, like {{data._id}} Angular 1.2.0 gives ...
0
votes
1answer
77 views

How to make a simple database query in Meteor

Every time I have a new idea for an application, I start with Meteor. And every time I end up using something else. And I think it comes down to me not knowing how to do a simple database query. ...
0
votes
1answer
33 views

Replacement update within cursor, MongoDB and Nodejs

This is the second time I've ran into this problem so it must be me that's doing something wrong. I create a cursor that contains all the docs of my collection with a projection, and want to iterate ...
0
votes
1answer
49 views

how i catch and insert Meteor.Error alerts From Meteor.Methods in to a client side db?

i just writing a error notification panel in meteor, here i create a client side mongodb, but i cant push Meteor.Error message in to that client side db by throwError function, currently it's shows ...
1
vote
0answers
31 views

double upsert in Node.js and mongoose

var urlSchema = new Schema ( { url : String, visitor : [{name: String,date: Date}], counter : Number }); var url = mongoose.model('url',urlSchema); var domain = blah blah; var conditions = { url: ...
0
votes
1answer
38 views

mongodb articles.length undefined

I am building a nodejs, express, mongodb blog, with jade. My folder structure is: project/ modules/ views/ index.jade app.js ...
0
votes
3answers
69 views

Add a new field to a document mongodb

I am very new to mongodb and have a basic question that I am having trouble with. How do I get the ID field of a document that has already been created? I need the ID so i can update/add a new field ...
1
vote
1answer
18 views

in mongodb, whats the easiest way to get an array of a single field from the documents

Assume, I have these documents in my collection: { _id: xxx, region: "sw" }, { _id: yyy, region: "nw" } I want to end up with an array like this: ['sw', 'nw'] I have tried mongodb ...
0
votes
1answer
41 views

MongoDB $sort aggregation

I have data base with user's activities and I'd like to count active users and number of activities that they made for each month, then sort result first by year, and each year sort by month! I've ...
0
votes
1answer
51 views

MongoDB Node - Getting the _id of an inserted object

I am having a conceptual problem with MongoDB, having recently switched from a relational database. I am trying to store an image with something like: exports.save = function ( input, image, ...
0
votes
1answer
21 views

How to set an property of a specific object in an array? mongodb

I have a mongodb document, for a project object: { members: [ { _id: ObjectId(1), active: true }, { _id: ObjectId(2), active: false } ] } I'd like to change ...
0
votes
1answer
86 views

Storing JSON data from Node.js to MongoDB

I'm pulling weather data in JSON format from Wundground through their API with no problems. I'm trying to store that data in MongoDB for later use. I actually get the data and am able to write it to a ...
0
votes
1answer
31 views

Passing a Mongo connection to JQuery code via socket.io?

I am trying to create a global MongoDB connection in my node.js web app like this: var MongoClient = require('mongodb').MongoClient; var mconn = null; ...
0
votes
1answer
61 views

How to update ~20,000 records in MongoDB with this criteria

I have a MongoDB document that looks like the following: "sport": "NFL", "team_id": 5, "week_num": 6, "meta": { .... more data ...., "season_year": 2013 } What I'd like to do is copy the ...
-1
votes
1answer
40 views

What is the most basic way for Node.js to send/return plain-text data to/from MongoDB?

With the following Node.js architecture: index.js + server.js + router.js + requestHandlers.js Am new to javascript application programming.. How does Node.js talk to MongoDB in the most basic way? ...
1
vote
3answers
81 views

How to make CRUD operations on a remote Mongodb with Nodejs

I recently started to play around with NodeJS - all I know is that it's a server side technology. What I did and want to accomplish are as following: I have a MongoDB running on a remote server. I am ...
0
votes
2answers
36 views

Iterating on Cursor from MongoDB

I am trying to get all the documents in the collection, so I can do something based on them. I am using the following code: var test = pool.getDbCollection('Events'); test.find() //get them all ...
1
vote
1answer
40 views

node + mongo: updating a record requires a callback

So I'm listening for an event with socket.io, once that fires I'm trying to update a record to a new value. socket.on('contentEdited', function (newContent) { collection.update( { '_id' : ...
0
votes
1answer
45 views

meteor mongodb _id changing after insert (and UUID property as well)

I have meteor method that does an insert. Im using Regulate.js for form validation. I set the game_id field to Meteor.uuid() to create a unique value that I also route to /game_show/:game_id using ...
0
votes
0answers
64 views

Javascript: recurse through object properties and replace a property if key or value matches pattern

I am accepting a user-supplied JSON string that looks like MongoDB query and I want to do some validation and processing on it and issue it to MongoDB as a query. I'm using MongoSkin driver for ...
0
votes
1answer
27 views

Assign property value doesn't work in Mongoose

My query is: db.Room.find({}, function (err, rooms) { if (!err) { async.each(rooms, function (room, done) { db.User.find({}, function (err, users) { if (err) { done(err) ...
1
vote
0answers
26 views

Implementation of Login dates in Javascript for Mongo

I am looking for ideas on how to capture the login frequency of an account using javascript in a mongodb. A Date Array is too expensive to store, and performance is a consideration. My first thought ...
0
votes
1answer
34 views

Pattern to 'feed' database rows to an interface

The problem is simple: fetch rows from a database and pass them to an interface. F.e. one implementation of this interface will write this data to an XML file. I'm looking for a pattern so: the ...
2
votes
1answer
47 views

Express.js request body __proto__

I have a little problem with request.body generated by express.urlencoded() middleware. In some cases it adds __proto__ at the end of request.body object and than it can't be used directly to initiate ...
0
votes
1answer
16 views

Mongoose: Null on nested property

I'm not sure if this is correct, but IMO should output TRUE while it outputs FALSE. Am I doing something wrong? var mongoose = require('mongoose'); var NestedSchema = new mongoose.Schema({ ...
0
votes
1answer
24 views

How to set _id to db document in Mongoose?

I'm trying to dynamically create _id's for my Mongoose models by counting the documents in the db, and using that number to create the _id (assuming the first _id is 0). However, I can't get the _id ...
1
vote
1answer
44 views

expressJS + MongoDB - login/register method

I want to have login/register function in my expressJS API. So now im just inserting password and email into my database, i want this function to first check if user with this email is already in ...
0
votes
0answers
138 views

Using database in AngularJS - where should I write DB connection code?

I'm now building up a web app using Node.js, AngularJS and either MySQL or MongoDB. However, when I tried to use AngularJS with a controller which includes datasets fetched from database, I wonder ...
0
votes
1answer
38 views

Populate select with keys from json

I have an array with an object in it, this is returned to the client through node.js server running with mongodb. I want to select all keys/fields in object(i.e. name, surname, telephone) but not ...
1
vote
2answers
40 views

MongoDB updating nested array with sort and slice, doesn't sort desc

I'm trying to push objects to an embedded array and sort by desc while slicing at 5. This works if I change created to 1, but it's 'ascending'. What happens now, is new objects, don't actually get ...
0
votes
1answer
35 views

Mongodb structure operation

Another day. Another Mongodb query. I wish to create the following structure in once of my collections: amitverma is the user and the nested object is message's UTC timestamp. I want to push ...
0
votes
1answer
49 views

Anonymous callback function in for loop in javascript

I'm trying to make a function inside an async.waterfall that checks each id in an array if there is any entry in a mongodb with this id (using Mongoose). If the id already exists it's to be removed ...
0
votes
0answers
63 views

Finding source of node.js's memory leak - buffer size growing out of control?

I'm getting some traffic to a server of mine and I'm not sure how to deal with this problem. I've added the nodetime to my app, and here's the result of a heap snapshot. Retainers > Other is up to 88% ...
0
votes
1answer
38 views

Backbone model.destroy with MongoDB persistence

I'm new to Backbone and to MongoDB. I'm running into problems destroying models (that are backed by MongoDB). I believe it has something to do with the fact that a MongoDB "document" uses the abnormal ...
-1
votes
1answer
27 views

Passing a parameter in $where with MongoDB

I've a little problem with my script. I cannot passing a parameter (MYPARAMETER in the example) in the function in the '$where'. You have an idea for help me ? Thanks. var MYPARAMETER = "dqsd qsdqs ...
0
votes
1answer
17 views

EJS/Javascript - For every 3rd entry, write X

I'm currently learning to write EJS views with NodeJS. Currently I'm making a products page that has three items per row, with all the items being pulled from a MongoDB. I have about 11 items for ...

15 30 50 per page