Questions tagged as 'mongoose'

0
answers

Nodejs - Inclusion of data in collection with mongoose

I would like to add an array of medals and challenges in my project by default. This way, I can create a medal and a challenge, but one at a time. // Save new projeto projetoController.save = function (req, res) { var projeto = new Projeto()...
asked by 07.02.2018 / 18:09
0
answers

Problems with mongoose searches

I'm having a problem to do a search on moongose, I have a function that does searches for all the ids I send but when I pass the id between "5a01e1dbaf371d00152eae89" it works very well however if I go through the function l...
asked by 29.01.2018 / 12:46
1
answer

Deprecated mongoose method

I'm trying to make a connection with mblab but the connection method is deprecated. Version of the method is 4.9.7. What I need is 4.13.7. Structure: server.js const express = require('express'); const morgan = require('morgan'); con...
asked by 26.12.2017 / 04:59
1
answer

Error in MongoDB / Mongoose?

I'm trying to start my server, but when I try to start it, it says MongoDB error, and I've been looking for a solution to this problem for some time now, and so far I have not found anything. What complicates even more is the fact that I was...
asked by 19.09.2017 / 18:46
1
answer

Mongooose Middleware to encrypt password in Schema

I'm having a hard time getting a Middleware in my schema with mongoose. I put it as save and I'm getting the error that it is not a function when I call it. See below both codes: schema.pre('save', function(next) { console.log('this gets prin...
asked by 24.08.2017 / 19:53
1
answer

I can not edit in CRUD - NodeJS + Express + MongoDB

Following: I started literally today working with NodeJS + Express + MongoDB and as an exercise I started with the famous CRUD (Create, Read, Update, Delete). I was able to do almost anything but edit, I'm really "beating myself" to solve,...
asked by 21.06.2017 / 03:13
0
answers

save () method of mongoose not saved

I have the following problem: When calling the mongoose save method it seems to be doing nothing. The code for the save is as follows: var newProjects = new projectModel({ "teste":"teste" }); newProjects.save(function (err){ if(err)...
asked by 24.05.2017 / 22:51
1
answer

Error in Mongoose findOne

I'm getting Error: Invalid argument to findOne(): 'texto pesquisado' when running findOne of Mongoose: const User = mongoose.model('users', mySchema); const query - 'texto pesquisado'; User.findOne(query, function(err, data) {...
asked by 12.05.2017 / 23:41
1
answer

How to do an update on Node.js and Mongoose

{ "_id": "58fe27e0e340671c9859c995", "__v": 0, "form": [ { "_id": "58fe2b1de437791cd02b9a8c", "sections": [ { "_id": "58fe2b1de437791cd02b9a8d", "input": {...
asked by 24.04.2017 / 19:04
1
answer

When I store the ID it disappears with some numbers

I was doing an application and in it I needed to store the id that is pretty big type This was my id 173782035419103232 but when I get to the database it changes to 173782035419103230 how can I do it so it does not round the number (Use the Mong...
asked by 15.04.2017 / 22:20