All Questions
Tagged with mongodb-query mongoose
3,145
questions
-5
votes
0
answers
32
views
how to find document inside array in mogodb [closed]
This is mongodb modal
new Schema(
{
mrp: {
type: Number,
required: true
},
selling_price: {
type: Number,
required: true
...
0
votes
1
answer
35
views
Mongo How to get only available documents by date
I have documents that associated to students:
[
{
'_id': 1,
'name': 'Anna',
'vacation_start: '2024-01-01',
'vacation_end': '2024-01-03'
},
{
'_id': 2,
'name': 'Bob',
'vacation_start: '2024-01-01',
'...
0
votes
0
answers
37
views
Mongodb: Error: Failed to create couple: Operation `couples.insertOne()` buffering timed out after 10000ms
I have mongodb setup locally and I created a database with a collection couples. I verified this using mongosh:
This is the code that connects to the database:
databaseConfig.ts
import { ...
0
votes
0
answers
24
views
MongoDB, how do I speed up my geo-query for a large collection (~20M docs)?
I have a colleciton with ~20M entries. Each document being a GeoJSON object with the following format:
_id: ObjectID,
properties:
-gml_id: String,
-....
-<A few other properties that don'...
1
vote
1
answer
68
views
How to perform find operation for query with ObjectId in mongodb?
I have a database of sessions where I stored the active sessions of users.
this is a screenshot of the Session database:
now, as we can see the user_id is storing the ObjectId of users and I want to ...
4
votes
1
answer
36
views
How to $match to find exact dict in list of dicts
I wonder if there is the way to $match in mongo to find exact dict in list of dicts
I have documents with this fields
{
_id: ObjectId("6644d9860e3b38f3dd724241"),
fields: {
...
1
vote
1
answer
38
views
How to have mongoDB populate subfields of transactions collection, for the sender and receiver, based on their _ids provided from the users collection
Here's my Mongoose Schema for the three collections users, accounts and transactions respectively:
const userSchema = new mongoose.Schema({
username: {
type: String,
required: true,...
0
votes
0
answers
50
views
NestJs - How to find by id if existing record in multiple collections (mongodb)
in mongodb, i have 4 collections to save conversations and comments from Facebook and Instagram. 4 collections is facebook_page_conversations, facebook_page_comments, instagram_conversations, ...
0
votes
0
answers
49
views
MongoServerError: E11000 duplicate key error when trying to add a video to a playlist in MongoDB
I'm working on a MERN stack application where I have a Playlist document in MongoDB that looks like this:
{
_id: new ObjectId('663296c9ca082f17ba715a4c'),
name: 'My Fav 02',
videos: [ new ...
0
votes
0
answers
27
views
getting an empty array in mongo db get request while using aggregate
so i am new to mongo db and don't know why my logic is not working...its showing me an empty array when i try to get a value of specficly something,
here is the code
let totalEarnedCurrentMonth;
...
3
votes
1
answer
75
views
Populate Arrays inside a mongoDB document which refers the same document
I have a document which has a field as Array of References and it is refering to the same document. I want to populate all the nested fields.
The Data will be Acyclic (person -> children -> ...
0
votes
2
answers
27
views
Querying for deeply nested subdocuments in Mongoose
I've been having trouble trying to query for a deeply nested subdocument while using Mongoose.
My DB structure is like this:
{
"_id": "662aa6ccae109745e30dc664",
"...
0
votes
1
answer
19
views
Would sending the single keyword to Atlas Search on MongoDb perform better then sending a different word for each query?
Essentially send a keyword to search all queries, my current implementation builds compound queries based on the presence of various query parameters. Not sure which param method would perform the ...
0
votes
0
answers
43
views
Populate Array object using typegoose
I have following structure in typegoose. How do I populate role based on RoleId as it is inside array?
export class PermissionBase {
@prop()
permissions?:
{
roleId?: Ref<Role>;
...
1
vote
1
answer
25
views
Missing 'winningPlan' while using 'explain()' with query in MongoDB
I've configured a search index on my collection and implemented the following queries:
Query 1:
db.productDimensions.explain().aggregate([{
$search: {
"text": {
"path&...