Questions tagged as 'mongoose'

1
answer

Reuse of connections on Nodejs + Mongoose

I'm now starting with Node and I used Mongoose to make my database connections to MongoDB. I put 1 log in my application, every time I open the connection it will print in this log. What happens: Every time someone calls my URL, my Node appli...
asked by 12.08.2016 / 22:06
1
answer

Filtering json data with schema attribute

I have JSON in this format: { "1": { "cidade":"cidade1", "name":"nome1" }, "2": { "cidade":"cidade2", "name":"nome2" } } I need to filter the data from this json. For this I made a model.js var mongoose = req...
asked by 25.05.2016 / 22:25
2
answers

Query using Mongoose in Nodejs always returns null even within asynchronous method

I'm trying to retrieve a document in my Database using Mongoose in Node.js but it always returns Null. My problem before was the asynchronous method, but now everything is running inside it. And I'm just trying to print the recovered document fr...
asked by 23.07.2014 / 17:01
2
answers

Undefined when accessing class attributes in NodeJS

Good afternoon guys, I was developing an api with node and mongo using express and mongoose and tried to implement the pattern repository, but when accessing the attributes of a class it returns an undefined message that I do not know the reason...
asked by 13.02.2018 / 17:59
1
answer

Difficulties in doing find () in schema / model mongoose with req.params.field in $ get from http

As the title says, I'm having a hard time making a find() customized in the model / schema of the node, which links to the mongoose. My following correspondence.js file (model): var mongoose = require('mongoose'); var Correspo...
asked by 08.11.2017 / 13:43
0
answers

How popular a sub list of a document with mongoose?

Is it possible to populate a list that references another list in the same document? Example in the image below, I want to popular / return in a search always the access link referring to another list of links that has all the information. This...
asked by 07.11.2017 / 14:50
0
answers

Post-Payload Error (Node.js)

Today when I was performing the post from a larger base 64 is returning this from my server. When uploading a smaller image it sends without problems, I tried to use some solutions limiting the server to 50mb but it did not work. server.use(bo...
asked by 31.08.2017 / 19:45
0
answers

Changes do not take effect when I change Schema, using mongodb and nodejs

Whenever I make a change in my Schema I have to restart my mongo server or node for the changes to take effect. I'm using the nodemon, but it does not always update, has anyone ever had it? module.exports = function(app){ var Schema = r...
asked by 25.07.2017 / 14:46
0
answers

KeystoneJS with Mongo remote

Good evening! I'm starting to study KeystoneJS versão 0.3.17 . Following "Getting started" from the official website, we ask for nodejs and mongodb , but I want to use this cloud service from mongodb . How could you do this...
asked by 01.06.2017 / 01:32
1
answer

How do you associate a calculation function inside an express function to use in routes?

With a very big question, I have a function that does calculations of user metrics and I want to put it in an express function to be able to return a JSON and use it in a route, follow the code to use in the routes: / p> const calculate_followe...
asked by 16.05.2017 / 00:56