Questions tagged as 'mongoose'

1
answer

PassportJS + Express with Node.js, req.session.passport Undefined

I am new with this framework and I was trying to do a 'Registration and Login' test with PassportJS + Express + Node.js + MongoDB and Redis. The registry works perfectly and apparently the login also, the problem is that when logging in I want t...
asked by 21.02.2018 / 05:05
0
answers

stear value of a variable in Mongoose

I do not know why the value is not assigned to the variable amount . Thanks var mongoose = require('mongoose'); const bodyParser = require('body-parser'); var menuModel = mongoose.model('menu'); var reservationSchema = new mongoose.Schema(...
asked by 13.02.2018 / 19:29
1
answer

Error in Cast to ObjectID

Good morning: I start from the following scheme: var schema = new Schema({ id: { type: ObjectId }, title: { type: String, required: [true, 'Title required'] }, students:[{ id : ObjectId,...
asked by 19.10.2017 / 14:01
1
answer

Update a document with mongoose

Greetings community.! I'm making a small application using node and mongoose and I want to update a specific field of a document ie: I have a document called Libro with a property ejemplares_disponibles of type...
asked by 21.08.2017 / 18:28
1
answer

As documents returned by mongoose

I'm trying to manipulate a document that returns me a mongoDB query through mongoose but I manage to get it. I'm developing with Node.js with Koa and Mongoose framework as ODM. The code is: const Router = require('koa-router'); const Restau...
asked by 11.04.2017 / 17:44
1
answer

Mongoose - Queries with OR and AND

I'm trying to make a query in mongoose and I can not think of how to put it together. In SQL it would be something like this: SELECT * FROM MATERIAS WHERE activo = true AND nivel = $nivel_id AND (alldisc = true OR disciplina =...
asked by 21.02.2017 / 06:41
1
answer

Using Node, Express and Multer to upload a file to MongoDB? What should I use, Multer or GRIDfs?

Hi, I'm running a final project in Heroku using MongoLab and Multer to upload photos, it seems to work fine, but after a few hours or less the photos disappear from the page, but leave the img placeholder, the symbol appears when the browser can...
asked by 20.01.2017 / 18:10
1
answer

problem with mongoose database

I have an error that sends me postman Product is not a function My code in nodejs is as follows 'use strict' const express = require("express"), bodyParser = require("body-parser"), mongoose = require("mongoose") const...
asked by 31.10.2016 / 12:47
1
answer

Pass nodejs variable (Express) to Javascript [closed]

Suppose I have a database in mongodb, in which I can store some information with .save () but now, I want to retrieve that information and pass it to the client, for which I use findOne () to acquire the desired data , that data I want to pass t...
asked by 21.12.2018 / 05:00
1
answer

I can not import model in route typescript

PS: Apart from the info below, here is the source: link The question is, why can not I access "User" which is a model for mongoose from a route? That's how I have the router. As you can see, User gives me an error "Can not fin...
asked by 05.12.2018 / 14:26