Questions tagged as 'mongoose'

2
answers

Error - Password update bcrypt mongoose without encryption

I am not able to encrypt my password during an update using bcrypt on mongoose. The password is changed without problems, but without encryption. Follow the schema: var mongoose= require('mongoose'); module.exports= function(){ var schema=...
asked by 28.05.2015 / 14:50
2
answers

How do I get a URL parameter in Express?

My URL is coming like this http://localhost:3000/menus/5.5 and it is bringing all the records of 5.5, but I would like the URL to be http://localhost:3000/menus?price=5.5 to have the same result, as you can see below; Thecodeth...
asked by 19.08.2018 / 10:39
1
answer

Relationship between documents - MONGODB

I have the following template: A schema called suspects, which has information from suspects. And other 3 so-called alerts, criminal actions and risky events. These 3 other schemas, should have the data of suspects, for example, the same suspect...
asked by 26.10.2017 / 15:47
1
answer

Search and Replace mongodb database

I have several collections in mongodb and I would like to do a "search / replace" for all collections and for each field that is string "http:" replace with "https:" Example: var object = { "_id" : ObjectId("58e7c7a5b03d4641f2aad7bb"),...
asked by 11.04.2017 / 19:05
1
answer

Heroku - Connetar with mongoDB addon mLab

I need to connect to the Mongo database using the mLO addOn. But I'm not able to insert or list, when running in local mode is working. I have the variable set: Anyideawhatitmightbe?Myapp.jsvarexpress=require('express');varpath=require('path...
asked by 29.10.2016 / 12:45
1
answer

Mongoose - Single object in an array

I'm new to MongoDB and Mongoose, I'd like to ask a question. I would like to store multiple objects in an array, and the object must be ONLY ONLY in that array, based on a string. See the example below: var list = { name: "List 1", reci...
asked by 31.05.2016 / 15:35
1
answer

Find in mongoose bank by Nodejs

I'm trying to access the mongoose database by doing a find on the nodejs. In mongoose, I have the following data: Client:{ name: {type: String, trim: true, required: false, default: ""}, address:{ country: {type: String, trim: tr...
asked by 20.07.2015 / 18:45
1
answer

Generate Json x Search on mongodb

I'm generating a Json. But I have the following situation: I have a contact record that can belong to the same company. That is, I can have two people registered in a single company. How do I load these contacts into my json? I'm doi...
asked by 25.06.2015 / 14:47
1
answer

Mongodb seeks to return internal arrays

Example structure: { "_id" : ObjectId("598d4eb912f28534d80a5820"), "nome" : "Emilio", "produtos" : [ { "_id" : ObjectId("598d4fb912f28534d80a5821"), "nome" : "produto1" }, { "_id" : ObjectId("598d4fb912f28534d80a5...
asked by 11.08.2017 / 09:25
0
answers

How to optimally handle errors in Mongoose

I'm starting to work with MongoDB + Mongoose and I'm having trouble dealing with the errors that mongoose generates. One of the same is when there is a duplicate key for a parameter that should be unique. Ex: Model (UserModel) const mongo...
asked by 03.04.2017 / 06:05