MySQL "IN" operator performance on (large?) number of values

I have been experimenting with Redis and MongoDB lately and it would seem that there are often cases where you would store an array of id's in either MongoDB or Redis. I'll stick with Redis for...

Embedded MongoDB when running integration tests

My question is a variation of this one. Since my Java Web-app project requires a lot of read filters/queries and interfaces with tools like GridFS, I'm struggling to think of a sensible way to...

MongoDB aggregate query using PHP driver

I have a working MongoDB aggregate query which I can run via the MongoDB shell. However, I am trying to convert it to work with the official PHP Mongo driver...

Date query with ISODate in mongodb doesn't seem to work

I don't seem to be able to get even the most basic date query to work in MongoDB. With a document that looks something like this: { "_id" : "foobar/201310", "ap" : "foobar", "dt" :...

Mongo db aggregation multiple conditions

I want to project a collection applying exporting a value only if a field is inside a range. Sort of: db.workouts.aggregate({ $match: { user_id: ObjectId(".....") } }, { $project: { ...

Return certain fields with .populate() from Mongoose

I'm getting returned a JSON value from MongoDB after I run my query. The problem is I do not want to return all the JSON associated with my return, I tried searching the docs and didn't find a...

How to disable mongoDB java driver logging?

I am trying to disable log outputs of mongo-java-driver-3.0.0. I have tried to set those in the beginning of my application, before loading the mongo drivers, but it didn't help. // Enable...

How to return only specific fields for a query in Spring Data MongoDB?

How can we select specific fields in Spring Data Mongo. I tried the following but I got cast exception from Foo to String. Using @Query @Query(value="{path : ?0}", fields="{path : 0}") String...

Why do I get the following error : Can't find a codec for class com.mongodb.client.model.geojson.Polygon

I am trying to do a geospatial query using MongoDB's com.mongodb.client.model.geojson.Polygon class and com.mongodb.client.model.geojson.Position class. The client code populates the four double...

Spring Data Mongodb Near Query not works

I would like to find the nearest shop. So I wrote this code: public class ShopRepositoryImpl extends GenericRepositoryImpl<ShopEntity, String> implements ShopRepositoryCustom { @Autowired ...

Node + Mongodb + ObjectId not working

I am working with nodejs+ express and mongodb. I am using postman and access the API. When I use ObjectId the server not responding anything. If i removed means working good. I am not able to fix...

Difference between decorating a property in C# with BsonRepresentation(BsonType.ObjectId) vs BsonId vs ObjectId

Am new to mongodb and am liking how easy it is not to worry about schema stuff, I have a question suppose you want an Id property in mongo and mongo uses ObjectId to denote property Id's, so far i...

How to join collection in Mongodb using node.js?

I am working on mongodb join query using node.js, i have two collections and i want to join two collection and wants to populate the data. Drinks Collection [{ "_id":...

error java.lang.NoSuchMethodError in java-mongodb example

I have been trying to execute my first mongodb example in java. Its showing me the error. I have installed everything properly. Any help would be appreciated.it is throwing an exception Exception...

Spring Data mongo case insensitive like query

I want to make a text search case insensitive with regex query with spring-data mongo . For example in Oracle : select * from user where lower(username) like '%ab%' How can i make this query ...

Mongo db Query to filter nested array of objects in document

I have the following document { "userid": "5a88389c9108bf1c48a1a6a7", "email": "[email protected]", "lastName": "abc", "firstName": "xyz", "__v": 0, "friends": [{ "userid":...

LetsEncrypt SSL Certificate Validation Failed with MongoDB

A little background...my certificate is a LetsEncrypt.org SSL certificate issued with Certbot. I'm running Nginx 1.12.2, and I'm able to properly access my website using https:// so I believe that...

C# MongoDB IAsyncCursor Explain

I am currently having a text index in my data. I am performing a regex search and I want to make sure that the correct index is used. In the mongo shell I just used explain but how could I use...

How to drop index from mongodb schema using mongoose?

I'm trying to remove an index from my mongoDB collection in node.js application using mongoose. I tried using model.collection.dropIndex("username") but it gives me an error...

MongoDB: Update field using value from another field

Using Mongo shell, I am trying to add a field which has the same value as an existing field for all documents in a collection. Assuming we have two documents : { 'foo': 'str1' } and { ...

Retrieving and displaying image from GridFS Python Flask Mongodb

Hi I am currently using Python Flask to store my images, I have successfully use gridfs to store the images into the mongodb, but now I am unsure how to retrieve the images. I understand that...

MongoDB / Mongoose - Text search inside array

I need to perform a text search inside array elements. Is it possible? Using Mongoose in Node.js and my userSchema looks like: { _id: "123456", name: "Lucas" items: [ { title: "Shoes",...

How can I access my MongoDB on my Linode VPS?

I have a nodejs app running on my Linode VPS, with MongoDB installed. I cannot connected to the database on the same VPS as it gives me 'Unauthorised' error. SETTING UP THE DB AND USER ON THE...

MongoTransactionException: Query failed with error code 251

Faced this Mongo exception when query a document in a transaction, with a specific id only (all other ids are fine): Exception occured: org.springframework.data.mongodb.MongoTransactionException:...

Elasticsearch Indices keeps getting lost

I have an Elasticsearch cluster on AWS ec2 instance. It is t3.small with 2 vcores and 2 GB ram. I have installed Elasticsearch & kibana. For extensions, I have installed Heartbeat and Metricbeat....

How do I execute MongoDB shell query using NodeJS

I know we have various packages avalable on GitHub to query MongoDB using NodeJS. They don't solve my use case. I am looking to execute MongoDB Shell commands from NodeJS which are different from...

Mongodb C# Update element in an multiple array with multiple values

I want to update the single document in collection with the guid as filter and update value is cityType. Every guid has different citytype here i have used 3 types it may be more. So please give a...

How to map over results in Realm custom resolver function find() response?

I am trying to create a function for my custom resolver that gets all documents in a collection and returns an amended payload with new data. Below is the code that im using to get one client and...

Connection is not open when use mongo.Connect instead it does when I do the query

I'm writing a Go app using mongo-driver to connect to the mongo replica set. I've noticed that mongo.Connect is not actually connect to the database. Even if I've shutdown the mongod instance,...

Is there anyway to disable "Retryable writes" to false in Spring Boot 2.2.1

First time I am trying to develop a controller to save data in DocumentDB in AWS. In the first time it saves, but in the second time, I am looking for this register saved in database, I got this...