All Questions
Tagged with mongodb-query node.js
2,472
questions
-1
votes
0
answers
26
views
I want to sort my data according to nearest location
Hi i want to get data nearby location for that I am providing coordinates so its giving right data but I want all data in sorting order by coordinates like I have searched for vadodara then it should ...
-1
votes
1
answer
19
views
I've been trying to apply unique index in combination in mongoDb databse using in my node.js backend, but unable to get away with the duplicate error
The movie is supposed to be added to the single document named as watchlist of all user, but i tried to apply unique index in combination of profile_id(user) and content_id(movie_id) so that same ...
0
votes
0
answers
21
views
Mongo DB Atlas | Aggregation not getting response
Am doing a personal project and using MongoDB Atlas for storing documents. I have the below code
app.get('/admin/dashboard', (req, res) => {
console.log('Received request for admin ...
0
votes
0
answers
22
views
Mongodb query doesn't post or put data in deploy
I'm developing a simple forum website. It has a react frontend + node backend, with mongodb cloud as database and AWS Cognito for signup/ verification/ sign in. When a user signs up: 1. create a user ...
1
vote
1
answer
71
views
How to write an efficient mongo query for complex structures
I am using express/nodejs(without mongoose) and mongodb as my database. I have a collection Pages which looks something like this
{
_id: ..
Urls: [
{
IncomingUrl: "/test/test1",...
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'...
0
votes
0
answers
18
views
New user not being registered in mongodb from nodejs and express
I have developed an API using Node.js to facilitate user creation and management. Each user is granted the privilege to book visits to properties within the system. While user registration and ...
0
votes
0
answers
20
views
Why my query is not executed properly in postman but when I used that query in MongoDB compass it will work fine
{members: { $in: [user] } }
i am tring tring to execute this query in my project, postman show no data and in mongodb campass it is showing 1 doc and that it i want.
the req.query is equal to this
...
0
votes
1
answer
42
views
mongoDB how to populate sub sub document?
I have a Node.js application with a MongoDB database and using mongoose to interact with it.
I have two important schemas:
First is the product schema
export const productSchema = new Schema({
name: ...
0
votes
0
answers
46
views
Filtering MongoDB collection by date with .find() method ommits some of the records
I am trying to .filter() my MongoDB collection by date and $gte and $lte operators with the MongoDB node package. It simply doesn't work as expected and it omits some records. I have spent several ...
0
votes
3
answers
179
views
MongoDB - $lookup not getting an appropriate result
Here I just need to look up three tables first need to get all subjects from the subject table according to classid and boardid then from the content table we need to get all topic and content details ...
0
votes
1
answer
101
views
the transactions are not rolling back in mongodb
var mongo = require("mongoose")
session10 = await mongo.startSession
try {
await session10.withTransaction(async () => {
console.log("transaction ...
1
vote
2
answers
62
views
Mongodb finding $near by data in array of objects
I'm trying to retrieve one specific object from an existing array inside the DB document, using wildcards $near and $geometry.
I have a model that looks like this:
const schema = new mongoose.Schema({
...
0
votes
1
answer
28
views
Optimizing MongoDB Query Get TotalRecord in Node.js
I have a MongoDB query in my Node.js application that I would like to optimize for better performance. The query looks like this:
const CampaignStepHistoryList = await CampaignStepHistory.aggregate([
...
1
vote
1
answer
64
views
MongoDB - findOne(query) vs countDocuments(query, {limit: 1})
I am using Node.js and its native MongoDB Driver. I am not sure which of the two methods is efficient to check if at at least one record matches my query criteria. Please note, I don't need any fields ...