Questions tagged as 'mongoose'

1
answer

Change document after post-save middleware in mongoose

I'm working with mongoose.js and I'm going to need to, after saving the document in the database, I get attribute of that document. From what I understood in the mongoose documentation itself, I realized that I could do this using a middleware...
asked by 01.06.2017 / 20:37
1
answer

TypeError: uri.indexOf is not a function

I'm doing a crawler using node.js and mongodb to save the information in the database and I have the following code: var request = require('request'); var cheerio = require('cheerio'); var save = require('./savedb.js'); var URL = require('url-...
asked by 01.06.2017 / 01:08
1
answer

Find in two collections using aggregation

I need to perform a find on two collections in mongodb using aggregation and put the results into a single array. I'm trying to do this, but it does not work. I have the collection Visits and Opportunities and want to summarize the amount...
asked by 16.03.2016 / 15:31
1
answer

Specific element update in a Mongoose array

How to update the following registry:   "_id": "56dd4489800f800000000000", "registro": "2014-09-07T09:06:17.214Z", "stars": 0, "observacoes": [ { "texto": "", "dataResposta": "", "idUsuario": "56dc9f9f68d7078888888...
asked by 07.03.2016 / 10:27
1
answer

Add url json event in fullcalendar

I'm using fullcalendar, nodejs, and mongoose. I have already been able to generate the json file. But by passing the path in fullscalendar js, I can not retrieve events. I created a test file in json and called it as follows: script(type='...
asked by 12.06.2015 / 16:06
0
answers

Redeem the last MongoDB record

I'm trying to redeem only the last record from a collection in Mongo and Mongoose. Passing this command: db.measurements.findOne().sort({ field: 'updated', _id: -1 }) The following error appears: 2018-12-13T13:12:25.702-0200 E QUERY...
asked by 13.12.2018 / 16:19
1
answer

Mongoose query returns an empty Array

I'm studying mongoose and am facing a problem. When trying to use find it just returns an empty vector while it should return all of MongoDB. Here is the code. var mongoose = require('mongoose'); var Schema = mongoose.Schema; mongoose.c...
asked by 03.12.2018 / 06:29
1
answer

nodejs + mongoose how to make one query need another?

I have two tables they have a link id being table A (Initial) tableB (dependencies) but there may be dependencies dependencies. I'd like it to just return in the dependency sequence. function Deps(dt) { return new Promise((resolve,reject)...
asked by 11.11.2018 / 07:23
0
answers

Return data with the same field

I'm new to mongdb and would like to type a "Select" that would return people with identical fields eg: a collection has the fields: name, profession. Would you like to return all those who have the same profession as I do in Mongo?     
asked by 26.09.2018 / 21:24
0
answers

ERROR LOGIN EXPRESS-SESSION

I used session-express to create a login session on a system, but I am having a curious problem, I can log in normally, I have page control, stored sessions in the bank etc, however, sometimes in the system it has an hour that it reaches a "limi...
asked by 23.08.2018 / 17:40