Questions tagged [mongodb]

MongoDB is a scalable, high-performance, open source, document-oriented NoSQL database. It supports a large number of languages and application development platforms. Questions about server administration can be asked on http://dba.stackexchange.com.

0
votes
0answers
5 views

Defending against XSS attack with mongoose

I am working on a project in node.js which uses mongoose to handle MongoDB. I want to defend against XSS attacks. What is the suggested way to do it? I found this: https://www.npmjs.com/package/...
0
votes
0answers
4 views

MongoDB documents expiring too soon (mongoose)

I set expiry time to 24 hours, but the documents expire after around 5-10 minutes (I haven't timed it exactly). What am I doing wrong? My schema: const collectionSchema = new mongoose.Schema({ ...
0
votes
2answers
10 views

Hi, I have 209580 objects in an array, how to save all at once in MongoDB using mongoose?

I have 209580 objects in an array, how to save all at once in MongoDB using mongoose?
0
votes
0answers
3 views

Insert multiple document with Hibernate OGM 5.3 into MongoDB

I'm stuck in an issue trying to persist a List of entities into mongoDB using wildfly and OGM 5.3. The problem seems to be the size of the List because I tried to save only five elements of the List ...
0
votes
0answers
7 views

Signifance of overriding MongoDBs ObjectId

I am working on an integration where I am overriding the _id field to keep track of sessions. I am doing this using Spring and a Converter interface, and instead of MongoDBs generated id I am placing ...
0
votes
1answer
21 views

React.js: Raw HTML string does not gets recognized as HTML elements from Node.js

I am sending a raw HTML from node.js to react. and It was successful. However, when I try to render it, they are render as raw string as opposed to HTML elements This is how I get the string from ...
2
votes
0answers
18 views

Fill class with information from multiple MongoDB collections through Linq left join

I have a problem with LINQ joins in C# on a MongoDB database. Here is the class I want to fill: public class CompanyProduct { public string _id { get; set; } public string paymentId { get; ...
0
votes
1answer
14 views

Mongo C#, query all documents, which array contain a specific element

How do I query in mongo all documents that contain a specific element? public class House { public Room [] Rooms {get; set;} } public class Room { public string Name {get; set;} } I need ...
-1
votes
1answer
17 views

How to remove data from multiple collections in express js?

I have created three collections, family {familyname , _id} root {rootname familyId _id} child{childname rootId familyId _id} Now if I delete family, root, and child should also be ...
0
votes
1answer
30 views

Returning Callback in Javascript

Taking inspiration from this answer http://stack.kinokrad-co.coma/21571589/9036255 I decided to copy this into my own code. I've found that it doesn't give any response. function getCallback(...
-1
votes
1answer
13 views

How to delete records from multiple collection by id in express js?

I have created three collections, family {familyname , _id} root {rootname familyId _id} child{childname rootId familyId _id} Now if I delete family, root, and child should also be ...
1
vote
0answers
14 views

How to use Elasticsearch search functionality using Spring Boot framework and the insertion is made through MongoDB?

I have a Spring boot application which uses MongoDB to store the documents. Now, I want to add the searching functionality to my API using Elasticsearch. How will I do this and how will MongoDB and ...
1
vote
1answer
21 views

Cors and database uri problem in scaling out architecture

I have react frontend and spring boot backend with mongodb behind. I have issues with setting 2 parameters in the spring boot service. First is address of the mongodb which is now set as localhost:...
0
votes
0answers
10 views

Doctrine and text search with selectMeta()

I am using Doctrine ODM (+MongoDB) and Symfony. Here is the code for text search ($q is the term we want to search): $builder = $this->getRepository('Word')->createQueryBuilder(); $builder-&...
0
votes
2answers
24 views

$pull operator in MongoDB

{ "_id" : ObjectId("5badfada90fd543fd8aa7f96"), "__v" : 0, "deleted" : false, "groups" : [ { "group" : "grp", "_id" : ObjectId("...
0
votes
1answer
22 views

I'm working on a MongoDB schema design. There is a confusion

I am currently working on MongoDB schema. But there's a bit of confusion. Description of the portion of the schema. USER user { _id : ObjectId('asdasdadsadasdad'), birth : "1987.06.11", gender : "...
0
votes
1answer
26 views

Create and insert data into Mongo database when npm install is run

I want to create a database and insert a collection of data. I'm using NodeJs and Mongodb with some help of Mongoose. I'm trying to run the script from the package.json in order to prevent the pain of ...
0
votes
0answers
12 views

Load/import CSV file in to mongodb using PYSPARK

I want to know how to load/import a CSV file in to mongodb using pyspark. I have a csv file named cal.csv placed in the desktop. Can somebody share the code snippet.
0
votes
0answers
14 views

Connect mongodb 4.0 with robomongo

Here are the logs for my mongodb status which show in it is in running status [email protected]:/etc$ sudo service mongod status ● mongod.service - MongoDB Database Server Loaded: loaded (/...
0
votes
0answers
23 views

Unable to push object into array in Mongodb collection but Id is inserted

I am using comment array in my schema as fallows. I want to push comments data into that comment array using nodejs api var Schema = mongoose.Schema; var myfeeds = new Schema({ title: { ...
0
votes
0answers
13 views

Storing Application State in MongoDB vs S3 as JSON

I am making a meteor app using Mobx-State-tree , graphql and Mongo DB. In the app, there is a section called courses which has chapters which in turn has topics. The Course Section state is ...
0
votes
1answer
12 views

Combining mongodb codec registries in scala

I have two CodecRegistry implementation for a set of case classes. Most of them are created with macros. Now if I use the RegistryOne only, it works for set "One" - the classes from package one. ...
0
votes
0answers
27 views

Store Json string as MongoDB array in C#

I want to store a JSON string in an array format in MongoDB.This is my C# code for storing notification into MongoDB, here the field "Event_meta" field sending as a JSON string format to MongoDB. ...
2
votes
2answers
36 views

Apply condition in $lookup in mongodb

I'm new in mongoDb. I have set two collections. 1) book 2) comments book : _id title author posted price And comments is : _id bookId comment status I want to get get those book's comment which ...
1
vote
2answers
28 views

Update array filtering by 2 fields [duplicate]

I don't know if it is possible. I'm trying to do an automatic process to update all elements of a nested array in some documents. The array hasn't a fixed length. Below is a simplified example of ...
0
votes
1answer
19 views

Find Object that contains an unlimited number of properties, properties names and properties values

Having a mongoose Schema containing a property named 'attributes' of type Object. The 'attributes' Object can contain an unlimited number of properties, properties names and properties values. ...
0
votes
1answer
23 views

Callback function fires in both success/error cases

I have a Nodejs/Express API using Mongoose and Mongo. I have a function that does an update. The update works, but for some reason, it also always logs an error. Here is the block of code I'm ...
0
votes
1answer
11 views

How to use GridFS selectively

I am new to MongoDB. I read about how GridFS can be used to store files whose data is stored within MongoDB collections. This feature seems to be useful for storing documents greater than 16MB in size....
1
vote
0answers
26 views

How to remove certain radius from a given polygon

I am using Ruby on rails with mongodb. I have saved the boundary of a state polygon inside mongodb, Now i have got some certain latitudes and longitudes, I have to query mongodb where 1KM radius ...
0
votes
2answers
14 views

How to send the contents of multiple MongoDB collections to a route for rendering using express?

I have two mongoDB collections (players and opponents). I want to send the contents of both of them to the same route so I can use the values in different contexts. I am using the following code but ...
0
votes
0answers
15 views

Use C++ to query data to MongoDB in Node.js application

I have bump to this Node.js C++ Addons. Node.js is built on Google Chrome's JavaScript V8 Engine which is written in C++. That is how we can use C++ Addons. MongoDB is also written in C++ ...
-1
votes
1answer
17 views

show tostring on json element using jaxb

I start to study java + mongodb, so I start to do a restfull, all its works, but there is one attribute on my Cliente class, what I'd like to customize his deserialization, "the private ObjectId id", ...
0
votes
0answers
17 views

Opening a Mongo shell session on MacOS High Sierra using .NET Core

I can't seem to get the connection string to run with this code. What am I doing wrong? This is my code. var process = new Process(); process.StartInfo.UseShellExecute = false; process.StartInfo....
0
votes
1answer
24 views

TypeError: Converting circular structure to JSON loopback and mongodb

I have a remote method for loopback that I am trying to implement. "use strict"; module.exports = function(Quote) { /** * * @param {Function(Error, object)} callback */ ...
1
vote
1answer
28 views

Mocking DeleteResult of MongoDB using Mockito in Java

The unit test below is not able to mock DeleteResult for the Java code being tested. Getting a NullPointerException. I'm running the test on JUnit. Is it something to do with the Filters in the delete ...
0
votes
0answers
10 views

what IDE tool to use to debug MongoDB source code? [on hold]

I like MongoDB very much, and I want to know more about it. However, I don't know what IDE tool(Note:Linux or Windows) to use to debug its source code, could you tell me how to set up the IDE ...
0
votes
1answer
14 views

passing json formatted with information from multiple json documents nodeJs

I have a function where I would like to return an arrays of JSON objects with the necessary information. to send directly to the front everything ready. async listProcessByOffice(req, res, next) { ...
1
vote
2answers
20 views

Kubernetes mongodb readiness probe failure

I am trying to run the helm chart for mongodb and I am running into readiness / liveness probe issue. The Mongodb helm chart from the stable repository installs the pods and the services. But the pods ...
0
votes
0answers
11 views

Connecting Mongoose to MLab H10 503

I'm getting an H10 error with my node app on Heroku. It was working fine until I added Google analytics to my EJS files. My env port is set fine, the only other thing I think it could be is my ...
0
votes
1answer
18 views

Extract $graphLookup matches into documents

For context, I'm using MongoDB 3.6.4 and I'm trying to build a hierarchical schema for ACL permissions, but I'll boil the problem down and save the details. Say I have a simple collection C, where ...
0
votes
0answers
23 views

mongodb stitch returns all fields

I'm trying to get just one field back for all my documents. I'm new to mongoDB but I can't understand why this isn't working. var docs = db.collection("articles").find({}, { _id: 0, title:1})....
-3
votes
0answers
25 views

Multi room chat - Best Implementation [on hold]

So I want to create a large scale site where you can randomly chat with someone, and I wonder what is the best implementation for it (on the server side) : Firebase - good for login, the real-time DB ...
-2
votes
1answer
22 views

Decrementing a field of type number in mongodb and nodejs

I'm learning mongodb. I have a collection called item which has a field piecesLeft of a type Number, and I want to decrement this field value when a user orders this particular item. Any help?
0
votes
1answer
28 views

OverflowError: MongoDB can only handle up to 8-byte ints?

I have spent the last 12 hours scouring the web. I am completely lost, please help. I am trying to pull data from an API endpoint and put it into MongoDB. The data looks like this: {"_links": { ...
1
vote
1answer
30 views

asp.net api return json from MongoDB

I'm trying to return a document from MongoDB. I would prefer not to create a model due to the amount of fields in each document. This is what my current output looks like: "[{ \"_id\" : ObjectId(\"...
1
vote
1answer
10 views

How to change the Host Names without disturbing the availability of instance in Apsara DB for Mongo DB?

I understand how to change the Host Names without disturbing the availability of self-build Mongo DB Instance but I am not able to find any documentation related to doing the same on Apsara DB for ...
0
votes
1answer
33 views

MongoDB retrieve every document contained in another document's array

I'm new to MongoDB so this might be a basic question but I am having trouble in how to approach it. I want to find one document in my collection, like so: db.collection("articles").find({curid:"...
1
vote
2answers
28 views

React: use axios to post state to MongoDB

I am trying to post the states as data to MongoDB through Express and Node with Axios. class App extends React.Component { constructor(props){ super(props) this.state={ items: [{ ...
0
votes
0answers
27 views

Cannot connect/insert to remote MongoDB (4.0/2.7) C# .NET Framework 4.6.1 (nor 4.6)

I have tried all the binding settings I could, and I have also tried the "resultset" parameter in the connection string, as per another post. Basically I have a little mongodb test that works ...
1
vote
1answer
31 views

Search for multiple values in Mongoose at the same time [duplicate]

I have an array of values, such as: let items = ["abcd", "efgh", "ijkl", "mnop"] Sometimes there are a thousand items in this array, other times there are only a few. I also have a series of ...