Questions tagged as 'mongoose'

1
answer

MissingSchemaError: Schema has not been registered for model "Product"

Well, I'm following a tutorial on Node.js and MongoDB and I'm trying to create a product, so I create a list of attributes that the objects will have, until everything is ok. Following the video in question, I happen to the same error occurred...
asked by 06.12.2018 / 23:12
2
answers

Mongoose findone does not return values

Well, I have a problem here that I do not know what to try, I'm using express + mongoose. My model let mongoose = require('mongoose'); let users = mongoose.Schema({}, {strict: true}); module.exports = mongoose.model('users', users); My c...
asked by 18.11.2018 / 20:11
1
answer

NODE.JS - Error: Route.get () requires a callback function but got a [object Undefined]

In my roters I create: var express = require('express'); var router = express.Router(); var service = require('./../services/users'); router.get('/login', service.login); router.get('/register', service.register); router.get('/edit/:id',...
asked by 03.11.2018 / 17:07
1
answer

How to send html form to route node? Crud!

Hello, I have to send the information of an html form via POST to a crud on node and mongodb! I can not do it! follows the code below: pastebin code: link     
asked by 16.10.2018 / 14:29
1
answer

Add data per month using mongoose

Hello! I need to aggregate data per month to use later to make charts. I'm using Mongoose as ODM and the following scheme: module.exports = mongoose.model('atendimento', { id: String, id_atendimento: { type: Number, default: 0 }, i...
asked by 06.08.2018 / 18:55
1
answer

Get attribute within an array in MongoDB

Hello, friends. Good night! I'm having a problem in developing an api, I need to query some attributes within an array of a Schema in MongoDB to add them to an email in a request. Can anyone help me? follows the Schema model below: I need...
asked by 31.07.2018 / 02:46
1
answer

Problems with filter in lib API QUERY PARAMS

I'm using this lib to apply filters api-query-params I need to filter for this entity; 'use strict' const mongoose = require('mongoose'); const Schema = mongoose.Schema; const schema = new Schema({ id: { type: String,...
asked by 17.08.2018 / 18:27
1
answer

Autoload of models in Mongoose

I have an API in NodeJS where I created a file to be my datasource, in this file I make the autoload of my models reading the files of my app and for each one I import into the sequelize. The code is this: import Sequelize from 'sequelize'; im...
asked by 04.06.2018 / 21:33
1
answer

How to search and update data with mongoose?

I'm using mongodb with mongoose in nodejs, I have my schema like this: const UserSchema = new mongoose.Schema({ username: { type: String, unique: true, require: true }, balances: { dolar: {...
asked by 20.03.2018 / 00:22
1
answer

How to edit an attribute in the database?

I am developing an API where I want to edit information or login . I can already get the user information after logging in as you can see in the function: memberinfo apiRoutes.get('/memberinfo', passport.authenticate('jwt', { se...
asked by 29.01.2018 / 19:42