Most voted "mongoose" questions
Mongoose is a Mongodb object modeling tool, or ODM (Object Document Mapper), written in Javascript and designed to work in an asynchronous environment.
Learn more…189 questions
Sort by count of
-
0
votes1
answer123
viewsError in Mongodb/Mongoose?
I am trying to start my server, however while trying to start it accuses error in Mongodb, and I have been for hours looking for the solution to this problem and so far found nothing. What’s even…
-
0
votes1
answer180
viewsMongoerror: Unknown top level Operator: $expr
I’m trying to do this in my code and works perfectly on the localhost but on the Umbler server is giving error. FOLLOWS THE ERROR: MongoError: unknown top level operator: $expr Follow the code I’m…
-
0
votes0
answers31
viewsProblems with Mongoosis research
I’m having a problem doing research on moongose, I have a function that does research for all ids which I send when I pass the id amid "5a01e1dbaf371d00152eae89" works very well but if I pass by the…
-
0
votes1
answer135
viewsMethod of depreciated Mongoosis
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');…
-
0
votes1
answer245
viewsHow to edit an attribute in the database?
I’m developing one API where I want to edit information of users after the login. I already have catch the user information after logging as you can see in the function: memberinfo…
-
0
votes0
answers83
viewsMongodb error - geoNear "in geo indices"
To get a Mongodb database use the following code: router.get('/multibancos', function(req, res, next){ MB.aggregate().near({ near: { type: "Point", coordinates: [parseFloat(req.query.lng) ,…
-
0
votes2
answers662
viewsModel, Express and the Mongoose
I have the following code in express.js const express = require('express'); const load = require('express-load'); module.exports = () => { var app = express(); var bodyParser =…
-
0
votes1
answer1272
viewsHow 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: {…
-
0
votes1
answer60
viewsAutoload models in Mongoose
I have an API in Nodejs where I created a file to be my datasource, in this file I autoload my models by reading the files of my app and for each matter in the sequelize. The code is this: import…
-
0
votes2
answers152
viewsNode with mongodb not starting application
I’m trying to raise an application in Node with mongoose, (I am studying, MEAN book code house) and generates me the following error while trying to start the file server.js where I start my…
-
0
votes0
answers227
viewsGenerate chart using Chartjs in Express
I am trying to render a chart using Chartjs. I am using nodejs (Express) and mongoDB. The idea is to take the database data, go to the front, and from that, render the graph. I already have some…
-
0
votes1
answer881
viewsGet attribute inside an array in Mongodb
Hello, friends. Good evening! I’m having a problem developing an api, I need to query some attributes within an array of a Schema in Mongodb to add them to an email for an order. Could someone help…
-
0
votes1
answer192
viewsGenerate an array from a query in mongoDB (Mongoose)
Good morning! I need the data from a collection of Mongo on the front end. I’m using Mongoose as ODM, and I got a little lost in sending the data to the front end. In the query it returns me the…
-
0
votes1
answer123
views -
0
votes1
answer93
viewsFilter issues in lib API QUERY PARAMS
I am using this lib to apply filters api-query-params I need to perform the filter for this entity; 'use strict' const mongoose = require('mongoose'); const Schema = mongoose.Schema; const schema =…
-
0
votes1
answer390
viewsHow to send html form to route Node?
I have to send the information from an html form via POST to a CRUD (Create, Read, Update and Delete) acronym in Node and mongodb, but I’m not getting it. Code: // configurando setup e chamando…
-
0
votes1
answer1437
viewsNODE.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',…
-
0
votes2
answers395
viewsMongoose findone do not return values
Guys, I’m having a problem here that I don’t know what else to try, I’m using express + Mongoose. My model let mongoose = require('mongoose'); let users = mongoose.Schema({}, {strict: true});…
-
0
votes1
answer385
viewsMongoose query returns an Empty Array
I’m studying Mongoose and I’m facing a problem. When trying to use find it just returns an empty vector while it should return all from Mongodb. Here is the code. var mongoose = require('mongoose');…
-
0
votes1
answer1875
viewsMissingschemaerror: Schema hasn’t 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 objects will have, until everything ok. Following the video in…
-
0
votes1
answer69
viewsSearch between two values
Well I need to do a search on a collection where I have XI, XF, YI e YF I will send for example x:10, y:9 so I need to identify which location items satisfy that location. Given the items saved in…
-
0
votes0
answers26
viewsPopulating select with data sent from controller and trying to save to BD
I am sending to form an array to popular select so, controller that sends to the view: const novaForm = async ({ Maquina }, req, res) => { const maquina = await Maquina.find({status: 'livre'})…
-
0
votes1
answer1095
viewsNodejs and Mongo DB - Unhandledpromiserejectionwarning: Mongonetworkerror: Connection 4
I have the following connection code with Mongodb, it was working perfect, but now gives an error. const express = require('express'); const mongoose = require('mongoose'); const path =…
-
0
votes1
answer238
viewsSearching and subtracting dates
I am new in the area and would like to put a difficulty that I am having .. In the Mongo database I have an example table (returning this json) { "_id": "5cb7652fc278309ac78dce2b", "status": "Teste…
-
0
votes1
answer403
viewsConsume API with Javascript and save data in Mongodb
Hello, Currently I have an application that Backend is in PHP and consumes a JSON API. Through the query I can save the data in my Mysql DB. I want to know if it is possible to do this in…
-
0
votes0
answers128
viewsError while doing query
I am building a Rest api with Node, but when trying to get a pass parameters returns all the data. app js. const express = require('express'); const app = express(); const mongoose =…
-
0
votes2
answers181
viewsMongoose error or nodejs
I’m developing a simple script, but I’m stuck in an error that I can’t understand the reason, I created a model and apparently the error occurs whenever I try to access. Node:…
-
0
votes2
answers150
viewsI can’t create a Schema in Mongoose
Hello! I am learning to use Mongoose. I am trying to create a model, but the terminal is returning the following error: "Cannot read Property 'Schema' of Undefined" Where I’m going wrong? Follow the…
-
0
votes1
answer686
viewsInsert value in the Mongoose array
My model works as follows. A user has documents, but the user registers before they have these documents. What I’m basically trying to do is to update users in the document array. SCHEMA 'user…
-
0
votes0
answers118
viewsAuto-fill inputs in the edit form with old data
Well, I’m using Node.js and Mongoose (mongoDB) as a framework for the database. On the front end I’m using handlebars. The problem is that the inputs are empty even passing as parameter the object.…
-
0
votes1
answer67
viewsMongo Query is not working when I have a compound property (one inside the other)
I am trying to perform a query in the database of Mongo, when I have a simple property as for example: Nome: João Works smoothly But if I have a compound property as an example: Tamanho: { PP: 2 M:…
-
0
votes1
answer29
viewsUpdate a user’s schema
Hello! Recently in Discord I made a system of clans, using mongodb atlas, to learn how it works. The problem is that it creates the schema in the right atlas, but gives the update in the user…
-
0
votes0
answers31
viewsRing query using Mongoose
Good morning, I need to carry out a query by changing the data of the object in Mongoose but I have not obtained success in finding the internal methods that do this and both $Facet and subpipeline…
-
0
votes1
answer459
viewsHow to group data into an array, making a single object | MONGO + NODE
I would like to fetch user data along with their linked portfolios in an array, however, is bringing as two arrays. And inside each wallet has an array of "entrances" where you would like to bring…
-
0
votes0
answers31
viewsIs it possible to create a handleChange for a form that takes the values of a Redux store?
Next, I’m creating an app and came across this problem: I have a store set and want to create a data update form in Atlas (Mongodb). But I want this form, already come with the values that are in…
-
0
votes1
answer140
viewsLink data in Mongodb
Model const AvaliacaoShema = new Schema({ responsavel: { type: String, required: true }, time: { type: Schema.Types.ObjectId, ref: 'Time', required: true }, pergunta: [{ type: Schema.Types.ObjectId,…
-
0
votes1
answer278
viewsMongodb - Add documents that have a certain value within an array
Hello, thank you for your attention. If I have left any questions, please let me know. I found a problem that is driving me crazy. I have the following collection: { "_id":…
-
0
votes1
answer309
viewsAdd images to mongodb via api using Postman
Good morning, I’m building an api on nodejs to access mongodb. I want to add images in this database and return the path of this image to my android application. I want to store the images directly…
-
0
votes1
answer54
viewsUser.findOne() in a collection that is not 'Users'
I wrote an app that has an email verification logic and is triggered when the user makes the registration. I am using two models in Mongoose: one for users and one for authentication token. In token…
-
0
votes1
answer43
viewsReturn model function in controller
I need to return a model function in my controller as if it were a "virtual" from Mongoose, actually in the controller I would specify via "populate" the function name and return the function in the…
-
0
votes1
answer38
viewsSending data via ajax generating new "_id" in Mongodb
I am sending information via ajax to the backend in Node to update a document in Mongodb, but whenever I send the form via frontend, it generates a new "_id" instead of searching for an existing one…
-
0
votes1
answer177
viewsAggregate array of two or more collections in mongodb
Hello, I have two Collections and want to query the two Collections, like the sql "Join". The relation between the Collections is made as follows: medico: [{ medicoId: { type:…
-
0
votes2
answers72
viewsMongoose’s Findone method is running in infinite loop
I have the following problem. I have a Findone method to search if a user exists in the database, according to the user and password. But when I run the method - using Inuit, it ends up in an…
-
0
votes0
answers30
viewsObject attribute can be filled with function call? Javascript
I’m trying to turn a file. js in module so I can access it in another .js. So this file I want to export needs to be it integer an object, right? Example: File "database" module.exports = {…
-
0
votes1
answer333
viewsHow do I put more than one filter in my search for a get?
I am using mongodb and Node. In the code below I am only searching for an 8 digit code, but I wanted to put also a search by name, as I do? exports.getByCode = (req, res, next) => { Roles…
-
0
votes1
answer323
viewsHow to pass several parameters to query in Mongoose?
I want to do a Mongodb search with Mongoose (Nodejs), where I want the objects whose url attribute that is a string contains within it at least 1 of the values I have in an array. How could I do…
-
0
votes2
answers154
viewsPromise async/await not resolved
I am doing . map() in an array, to do a Mongoose/Mongodb query with each element of this array and returns another array with the results. However, after this process, I try to access the new array…
-
0
votes1
answer65
viewsHow . populate searches the data
I have a question about performance using Mongoose. Suppose the following models: const Disciplina = new Schema({ titulo: { type: String, } }) const Assunto = new Schema({ disciplina: { type:…
-
0
votes1
answer181
views.find() from Mongoose returns nothing when it should
I’m trying to make an appointment with Mongodb with Mongoose. The parameter is a $in with an array whose only value is a regular expression that selects the object if the attribute "url" has the…
-
0
votes1
answer601
viewsHow to save a json object to mongodb, which is the answer to an API post
I need to save a certain field,from a json object,which comes from the response of an API I called. Save some fields of this response json object,in some fields of my colletion/model on Mongodb also…