Skip to main content
Filter by
Sorted by
Tagged with
0 votes
0 answers
61 views

I'm currently trying to create the model using nestjs mongoose schema, and i want to convert the mongodb data from snake case to camel case in my schema layer like this: export type ...
Izukishi's user avatar
2 votes
0 answers
133 views

Mongoose connection to MongoDB Atlas fails with queryTxt ETIMEOUT I’m trying to connect my Node.js app to MongoDB Atlas using Mongoose, but the connection fails with a timeout error. Here’s the error ...
Kevin L's user avatar
  • 21
0 votes
0 answers
39 views

I've been trying to create a plugin which implements a query and schema method that populates a user field and selects some inner fields from it (firstName, lastName, image). I just can't seem to make ...
עופרי קרביץ's user avatar
0 votes
0 answers
28 views

There is an existing collection1 having a property which is an id of another collection2 but the data type is string. How do I convert this property to an objectId type with reference to the other ...
hemant's user avatar
  • 489
0 votes
0 answers
33 views

I have a collection named ‘policies’ which references control in its field 'associatedControls' from collection ‘controls’ and control has a field 'associatedFrameworks' where it references 'framework'...
Fuaad's user avatar
  • 480
2 votes
1 answer
107 views

I'm developing a Mongoose plugin that archives documents on every update by cloning the original schema. However, I'm facing an issue with unique fields: when a field is marked as unique, Mongoose ...
Eiskaffee's user avatar
0 votes
0 answers
35 views

I am trying to understand the Schema, Model and Mongoose based on their type. I am really confused regarding is Schema a class or just look similar to class? Is Model a class or just behave like class ...
jazz's user avatar
  • 3
0 votes
0 answers
32 views

I'm working with Mongoose to create a StepperDataSchema that contains a celebratorDetails field. This field can have one of two possible sub-schema structures: 1.BirthdayCelebratorDetailsSchema 2....
TalGav's user avatar
  • 53
1 vote
0 answers
41 views

I have a mongoose Schema and I would like to rename a certain property named 'template' to 'document'. If I would first change name of the property from 'template' to 'document' in the Schema and than ...
Paul's user avatar
  • 2,574
0 votes
1 answer
53 views

Note: I'm a beginner level person in typescript, so, instead of downvoting my question, please try to elaborate the concept. I'm having trouble using enum in my code. I want to use an enum(with values)...
Fuaad's user avatar
  • 480
0 votes
1 answer
59 views

I have a function in express js to update my project like below: projectController.ts export async function updateProjectStatus(req: Request, res: Response) { try { const projectCode = req....
Samiul Karim's user avatar
1 vote
2 answers
48 views

const mongoose = require('mongoose'); mongoose.connect("mongodb://localhost:27017/mongo-exercise") .then( ()=> console.log("Connected to MongoDB...")) .catch(err => console....
Tiar thar's user avatar
0 votes
1 answer
32 views

How can I retrieve the deviceId as a single numeric value in my Mongoose schema and Express.js controller? I'm using Mongoose with Express.js to save car records, and I've defined a deviceId field as ...
Spacewalker_vir's user avatar
0 votes
1 answer
25 views

I created a ProductSchema which is extended by a CategorizedProductSchema. The difference between them is that the CategorizedProductSchema has an attribute category which is of type CategorySchema. ...
BreenDeen's user avatar
  • 744
0 votes
2 answers
46 views

I have this schema: const User = new Schema({ firstName: { type: String, required: true }, lastName: { type: String, required: true }, mobile: { ...
Koladee1's user avatar
  • 117
0 votes
0 answers
41 views

Question: I'm implementing a custom Mongoose schema type called Password for handling password hashing using bcrypt. However, I'm encountering a TypeScript error specifically related to the return ...
Sikandar Moyal's user avatar
0 votes
1 answer
49 views

I want to search product with its name in below DOC Schema. But the products are stored as reference to another Product Schema with _id. Below is the code - DOC Schema import mongoose from "...
Raghav Patel's user avatar
0 votes
1 answer
76 views

I'm using NestJS. I'm making a schema for my mongodb, the schema looks like this: import { Prop, Schema, SchemaFactory } from "@nestjs/mongoose"; import { ProductInCartDto } from "../...
Long's user avatar
  • 11
1 vote
1 answer
192 views

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'), ...
DXB-DEV's user avatar
  • 630
0 votes
1 answer
58 views

i am a total begginer. I am trying to send a specific error message in password and password confirm validator in a mongoose schema. const mongoose = require('mongoose'); const userSchema = new ...
user25543263's user avatar
-1 votes
1 answer
65 views

//controller: const Product = require("../models/productModel"); //Create product exports.createProduct = async (req, res, next) => { const product = await Product.create(req.body); ...
ahmed khan's user avatar
0 votes
3 answers
82 views

I made a user schema based on mongoose or mongodb, in which there is a invitation code and this code is always unique in the database. import randomize from 'randomatic'; const userSchema = new ...
user824624's user avatar
  • 8,168
0 votes
1 answer
50 views

const mongoose = require('mongoose'); const { Schema } = mongoose; main().catch(err => console.log(err)); async function main() { await mongoose.connect('mongodb://127.0.0.1:27017/...
Shreesha Rao's user avatar
0 votes
0 answers
51 views

I have indexes setup on customer schema like below CustomerSchema.index({ firstName: 1, dob: 1 }); CustomerSchema.index({ firstName: 1, lastName: 1, dob: 1 }); CustomerSchema.index({ firstName: '...
karthik suryadevara's user avatar
0 votes
2 answers
84 views

I've been having trouble trying to query for a deeply nested subdocument while using Mongoose. My DB structure is like this: { "_id": "662aa6ccae109745e30dc664", "...
O'Diego's user avatar

1
2 3 4 5
68