Mongoose is a MongoDB object modeling tool, written in JavaScript, designed to work in an asynchronous environment.

learn more… | top users | synonyms

0
votes
0answers
12 views

Aggregate push N number of array results

I have the following aggregate: db.reports.aggregate({ $group: { _id: "$user", reports: { $push: {report: {properties: "$properties"} } }}}, { $project: { _id: 0, user: "$_id", reports: "$reports"} ...
0
votes
0answers
20 views

Upvote and Downvote with Backbone, Express and Mongoose

I am trying to implement a voting system similar to stackoverflow or reddit where a user would only be allowed to vote once on a given post. After following the advice given here storing ...
0
votes
0answers
8 views

Error: ERR invalid expire time in SETEX

I had a web app and after update i get error after 2 hours of working, i'm really don't inderstand what's the problem.Also in this new version i add a multiple connection for mongoDb using mongoose. ...
0
votes
1answer
23 views

How to push a new document in mongodb but only if it does not exist?

I have a POST being done that uses this code: exports.addContactPost = function(req, res, err) { User.findByIdAndUpdate(req.signedCookies.userid, { $push: {friendRequest: ...
0
votes
0answers
28 views

How to call get on a button?

How do you call a get on the add friend button to disable the button in jquery if the friend request was already added to the friendRequest Array? I included my take on it, but not sure what I am ...
0
votes
0answers
11 views

Average Field for Array in MongoDB - Mongoose

Schema: Schema({ ... review: [], count: {type: Number, default: 0}, average: {type: Number, default: 0}, ... }); Count and average is the number of reviews and the average ...
0
votes
0answers
21 views

How do I avoid duplicates friend requests in the db?

I am getting the correct data for friendRequests which is getting a user ID and throwing it in the friendRequest array. How do I stop duplicate requests or better yet just disable the button for a ...
0
votes
0answers
9 views

Mongoose changes default values on .find()

I'm fairly new to Node.js and particularly MongoDB, and I've come across a weird but infuriating issue. Everytime I "find" documents via Mongoose's .find() function, the document's default values, for ...
0
votes
1answer
24 views

How to push returned value into an array mongodb?

I am getting the correct data for friendRequests which is getting a user ID and throwing it in the friendRequest field of my mongoose file. When I add $push to add the data into the friendRequest ...
0
votes
1answer
35 views

How to pass data from jade to mongodb using NodeJS as the server language

I'm using NodeJS, Express, MongoDB, Mongoose and jade for the web app. I am wondering how I pass data from jade to mongodb. The data that I want to pass are texts inside certain divs that are appended ...
0
votes
0answers
38 views

mongoose functions only working on second call

So the weirdest thing is going on. I have a coffeescript class which I use to construct a mongoose schema. module.exports = class Profit constructor: (Schema, mongoose) -> ...
0
votes
1answer
17 views

One to Many mapping in mongoose, How to receive and process?

The problem I have is a One to many mapping with mongoose(Mongodb). The one is the Order(buyer data) and the many is the Items(price,quantity,etc). 1) How I should create the Schema for the the Order ...
1
vote
1answer
25 views

Mongodb Update Query Deletes All Array Fields Except Field Specified in Command

I'm new to MongoDB. I'm using Node and Mongoose. I've checked the mongo docs on set and update. I've Googled for a little over an hour now and I've found topics that dance around my issue, nothing ...
0
votes
0answers
43 views

Cannot figure out what I am doing wrong with add friend button

So I am trying to figure out how to make an add friend button. I am using Node.JS to route a POST with Jade as my view engine showing an input button in a form that is just an add Contact button. ...
0
votes
2answers
29 views

MongoDB Aggregation Multiple Keys

I trying to aggregate employees using department and status to calculate summ for each status. From this: { name : "Employee_1", department: "hr", status : "exist" }, { name : "Employee_2", ...

1 2 3 4 5 147
15 30 50 per page