Skip to main content

All Questions

Tagged with
0 votes
0 answers
38 views

Mongoose data not showing on the web page as expected

I am creating a web app for keeping notes using mongodb, node.js, express and pug. When I load the home page the notes are arranged in order of date created. When I click the button to arrange the ...
AllThingsShiny's user avatar
-3 votes
1 answer
63 views

I am building an app where I want the admin to update any user who are displayed in the admin panel

I am a beginner and got stuck in this problem. I am building an app where I want the admin to update any user who are displayed in the admin panel by clicking on the update button at the bottom of the ...
Siraj Saifi's user avatar
0 votes
1 answer
80 views

Unable to access a property of an object using Mongoose

Sample data: { "_id": "ObjectId_for_Site1", "name": "Site 1", "address": "123 Reeganangam", "manager": { "_id&...
Ashok Kumar Maharajan's user avatar
0 votes
0 answers
50 views

how do I wait for data to be fetched in javascript? [duplicate]

so i am fetching data from mongodb atlas and then store it in an array, then i pass it in pug , but issue here is what i think is that pug file is rendered before data could be fetched . here is the ...
Sanidhya Sahu's user avatar
0 votes
1 answer
278 views

Update HTML page on mongodb data change

I want to update the HTML/pug page of multiple users when particular data changes in my MongoDB database. A user(A) follows another user(B) (whose data is stored in a different collection). When user(...
Avi's user avatar
  • 31
1 vote
1 answer
62 views

I can't call PATCH method using Pug, Mongoose and Express.js

I am new to code and I apologize in advance for all my noob mistakes. I'm trying to set a new color to an existing object stored in MongoDB using the PATCH method in the browser, but I don't ...
Alex G's user avatar
  • 11
0 votes
3 answers
97 views

How do I sort array by numbers and also prevent it from increasing more then 15 length and take only the biggest numbers?

here is my code for now: router.get('/questions/best', function(req,res,next){ Question.find({}).exec(function(err,results){ if (err){return next(err)} let top15 = []; for(let i = 0; i&...
SweetWhite's user avatar
0 votes
1 answer
62 views

Can I update mongoose model that is once already rendered by using fetch?

I'm creating a web s like youtube using express. and I'm using mongoose for db and pug(jade) template for view. If I get to the home router("/"), the view file-"Home"- and db array-...
mrbrightside's user avatar
0 votes
2 answers
505 views

How to separate month and year in Date in pug

This is the format of date saved in MongoDB: Sun Feb 13 2022 05:30:00 GMT+0530 (India Standard Time) How to separate month, year and day from this date in pug? I want to take this date in pug and ...
Rishab Dugar's user avatar
0 votes
1 answer
162 views

To display specific data related of current user to get rendered

Hi I want to ask how to get data of booking for current user logged in, the schema model seperated into 2 files (userModels and bookingModels) userModels const crypto = require('crypto'); const ...
Fara 's user avatar
1 vote
1 answer
867 views

.cache() is not a function Mongoose

I just created a simple backend of Contact form Using Nodejs, Express and Mongoose. I used Pug template engine. I created a backend to take data from users through Contact form and save into my ...
Rahul's user avatar
  • 13
1 vote
1 answer
24 views

Pug render Mongoose: Error "cannot display [X] of undefined" but field is optional in schema and empty in some docs?

Noob here building a simple DB site with Mongoose, Express, Pug and Node. I'm emulating Mozilla's "Local Library" site tutorial, in case you're familiar with that. My Model has an optional ...
masterchinchilla's user avatar
0 votes
0 answers
26 views

How can I use a function parameter as a mongoose query?

The code is as follows... function getqueried(operand, a, b, c, d, e){ console.log('queriedobjects length: ' + queriedgameobjects.length); return GameModel.find({$or:[{"ho": {...
Giannis Koutivas's user avatar
0 votes
1 answer
311 views

Why doesn't "res.sendFile()" fucntion(Express.js) work with 'pug' files?

I am learning to use express with mongodb. I have this code & it works(it doesn't include 'pug' files though) var express = require("express"); var app = express(); var port = 3000; var ...
Sapthaka's user avatar
  • 410
0 votes
3 answers
652 views

How to set default option for dynamic select control in Node-Express-Mongoose?

I'm now working in Node-Express environment with PUG as a view engine. I have CompanySchema with one of the fields "comp_ParentName" which referring to schema itself: comp_ParentName: {type: ...
Maxmit's user avatar
  • 13

15 30 50 per page
1
2 3 4 5
9