All Questions
8,923
questions
0
votes
1
answer
9
views
Switch the Database of the default mongoose connection
In trying to limit the number of connections in my web application I switched from using mongoose.createConnection() to mongoose.connect()
Which works perfectly if your only ever using one database. ...
0
votes
2
answers
19
views
How do I use the find() method to query a mongoose schema with an enum field (can hold multiple values (array)) that includes a particular value?
I have this schema:
const User = new Schema({
firstName: {
type: String,
required: true
},
lastName: {
type: String,
required: true
},
mobile: {
...
0
votes
2
answers
56
views
Using an outer Boolean variable inside a mongodb aggregation pipe line logical operator $or
I have to check a Boolean flag and base on its condition return different data result.
for example I have a collection of books and their prices, normal result of query is prices matching 10, BUT IF ...
0
votes
2
answers
49
views
The filter is not returning the different id's its returning everything
So, i have been trying to make a function that deletes reviews and it just isn't working. I narrowed it down, and it seems that the filter is not working correctly, couldn't figure out why. Please ...
1
vote
1
answer
43
views
Mongoose Virtual Field Population Problem
I have a problem with current state of my database since it started with a very old backend wrapper. (Parse Server)
So here is the problem let's say I have two different collections Users and Stores ...
2
votes
1
answer
39
views
EJS Rendering Error: "allChats is not defined" Despite Data in MongoDB
I'm working on a messaging application using Node.js, Express, MongoDB, and EJS. The goal is to retrieve chat messages from MongoDB and render them using EJS. However, I'm encountering an issue where ...
1
vote
2
answers
88
views
I am unable to get Mongoose Aggregate method to work
I am building an api and I wanted to use the skip and limit methods in mongoose to handle pagination.
I would like to get the total document size along with the pagination data. Initially, I made two ...
0
votes
1
answer
73
views
How to store a Global variable between restarts with MongoDB
I have a $count command which increases a variable "count" by 1. Every time I reset my bot, the count goes back to 0, because I set it with let count = 0. My issue is that I don't want the ...
1
vote
1
answer
41
views
How to convert Decimal128 value to Float value in Node.js / Mongoose?
I got the following output from the Node.js backend server when I use the Orders.find() to find some documents from the MongoDB database.
{
_id: new ObjectId('6672a038a102620d14a93cac'),
...
0
votes
0
answers
34
views
MongooseError: Operation buffering timed out after 10000ms
Good morning everyone,
I've been working on a school project and I'm having trouble seeding the MongoDB database. When I run the provided code I get a "MongooseError: Operation 'trips.deleteMany()...
0
votes
2
answers
37
views
search for the next highest value mongodb
I am currently working on a price search engine with NodeJS and Mongoose and have a question about the implementation of a price matrix.
Each product has an icon, a type symbol, a width, a height and ...
1
vote
1
answer
80
views
convert object literal notation to dot notation for mongoose
In NodeJS I receive from Postman an object like:
sysData: {
status: 'active'
}
This needs to be dynamically converted to dot notation like
{ 'sysData.status': 'active' } so I can do a find with ...
0
votes
0
answers
24
views
How to pass the referenced boardId to the createColumn function
I am making a trello like app with mern stack. Everything going smooth until I create a column. Postman says "Invalid board ID". When I hardcopy an existing boardID to the route the column ...
1
vote
0
answers
37
views
Can't insert data to mongoDB if it's an Object type
I'm exporting data from an API to JSON files and importing them to MongoDB. My problem is that if I have an Object within the document I can't write data to that Object and I can't find what is ...
-1
votes
1
answer
58
views
MissingSchemaError : Schema hasn't been registered for model "User"
I was trying to connect to MongoDB database using mongoose and I also defined my model but while trying to run it I got the error given below
MissingSchemaError: Schema hasn't been registered for ...