MongoDB: how to add the specific fields from one query with alias to result of another query using Java (with or without Spring)?

If we have collection “orders” {“_id”:”1″, “currency”: “USD”//… } And collection “order_items” {“_id”:”1″, “order”:”1″, “product”:”p1″, “totalItemAmount”: 25 }, {“_id”:”2″, “order”:”1″, “product”:”p2″, “totalItemAmount”: 50 } How to get such result [{ “orderId”: “1”, “currency”: “USD”, “products”: [“p1”, “p2”] “totalOrderAmount”: “75” }] using Java (with or without Spring)?

MongoCommandException: Command failed with error 8000 (AtlasError): ‘no SNI name sent, make sure using a MongoDB 3.4+ driver/shell.’

I’m using Java 11 (Maven project) for mongodb Free Tier Cluster (Version 4.0.13). I’m trying to connect via connection-string (for 3.6 drivers or later) like: mongodb+srv://user:[email protected]/test?retryWrites=true&w=majority and by the same way via connection-string (for 3.4 driver or later): mongodb://user:[email protected]:27017,cluster0-shard-00-01-ox90k.mongodb.net:27017,cluster0-shard-00-02-ox90k.mongodb.net:27017/test?ssl=true&replicaSet=Cluster0-shard-0&authSource=admin&retryWrites=true&w=majority I’ve already tested different dependencies for java drivers like: mongodb-driver-sync (ver. 3.11.0), mongodb-driver-sync (ver. 3.10.0) ,…

Mongodb doesn’t save the data

I’m creating a CRUD with mongodb, and doesn’t throw a error, but when I try to insert the data, the data is not inserted. Someone help me please App.js const express = require(‘express’); const path = require(‘path’); const morgan = require(‘morgan’); const mongoose = require(‘mongoose’); const app = express(); // connecting to db mongoose.connect(‘mongodb://localhost/crud’, {…

Mongodb doesn’t save the data

I’m creating a CRUD with mongodb, and doesn’t throw a error, but when I try to insert the data, the data is not inserted. Someone help me please App.js const express = require(‘express’); const path = require(‘path’); const morgan = require(‘morgan’); const mongoose = require(‘mongoose’); const app = express(); // connecting to db mongoose.connect(‘mongodb://localhost/crud’, {…

how to check date $gte in mongodb for ‘dd.mm.YYYY’ date format

I want data where deliveryDate is greater than equal to current date but it is not working in mongodb. my deliveryDate are stored in “11.8.2018” this format. collection.aggregate([ { $match: {“deliveryDate” : { $gte: new Date(new Date().setDate(new. Date().getDate()-2)) } },{ $group: { _id:{ year: { $year: “$createdDate” }, month: { $month: “$createdDate” }, day: {…

How to change a property in a MongoDB collection every Sunday at 00:01 Midnight in app that written under Node JS?

I have an app on Heroku that’s written in Node JS and uses Mongo DB as a database. In Mongo I have a collection GamePlan that one of the properties is Status : const mongoose = require(“mongoose”); const Schema = mongoose.Schema; const GamePlanSchema = new Schema({ LeadId: { type: String, required: true }, PackageId: {…

MongoCommandException: Command failed with error 8000 (AtlasError): ‘no SNI name sent, make sure using a MongoDB 3.4+ driver/shell.’

I’m using Java 11 (Maven project) for mongodb Free Tier Cluster (Version 4.0.13). I’m trying to connect via connection-string (for 3.6 drivers or later) like: mongodb+srv://user:[email protected]/test?retryWrites=true&w=majority and by the same way via connection-string (for 3.4 driver or later): mongodb://user:[email protected]:27017,cluster0-shard-00-01-ox90k.mongodb.net:27017,cluster0-shard-00-02-ox90k.mongodb.net:27017/test?ssl=true&replicaSet=Cluster0-shard-0&authSource=admin&retryWrites=true&w=majority I’ve already tested different dependencies for java drivers like: mongodb-driver-sync (ver. 3.11.0), mongodb-driver-sync (ver. 3.10.0) ,…