MongoDB Compass: select distinct field values

I am using MongoDB Compass and don’t have mongo Shell. I need to build a query using mongoDB Compass tool to select distinct values of the “genre” field from my collection. Could someone help here, please? Sample Input: {“_id”:{“$oid”:”58c59c6a99d4ee0af9e0c34e”},”title”:”Bateau-mouche sur la Seine”,”year”:{“$numberInt”:”1896″},”imdbId”:”tt0000042″,”genre”:”Documentary, Short”,”viewerRating”:{“$numberDouble”:”3.8″},”viewerVotes”:{“$numberInt”:”17″},”director”:”Georges Mlis”} {“_id”:{“$oid”:”58c59c6a99d4ee0af9e0c340″},”title”:”Watering the Flowers”,”year”:{“$numberInt”:”1896″},”imdbId”:”tt0000035″,”genre”:”Short”,”viewerRating”:{“$numberDouble”:”5.3″},”viewerVotes”:{“$numberInt”:”33″},”director”:”Georges M�li�s”} {“_id”:{“$oid”:”58c59c6a99d4ee0af9e0c34a”},”title”:”The Boxing Kangaroo”,”year”:{“$numberInt”:”1896″},”imdbId”:”tt0000048″,”genre”:”Short”,”viewerRating”:{“$numberDouble”:”5.2″},”viewerVotes”:{“$numberInt”:”48″},”director”:”Birt Acres”} Expected output: Documentary,…

group first, make bucketauto second in mongodb aggregation

I have a dataset structured like that: { “id”: 1230239, “group_name”: “A”, “confidence”: 0.14333882876354542, }, { “id”: 1230240, “group_name”: “B”, “confidence”: 0.4434535, }, Etc. It is pretty simple to calculate buckets and number of items in each bucket of confidence level, using $bucketauto like that: { “$bucketAuto”: { “groupBy”: “$confidence”, “buckets”: 4 } } But…

how to resolve data validation fail in mongodb?

Ive created the following mongodb collection db.createCollection(“task3”, {“validator”: {“$and”: [ {“Company.cname”:{“$type”:”string”}, “Company.city”:{“$type”:”string”}, “Company.street”:{“$type”:”string”}, “Company.bldg#”:{“$type”:”int”}, “Company.bldg#”:{“$gt”:0}, “Company.bldg#”:{“$lt”:500}, “Company.budget”:{“$type”: “double”}, “Company.budget”:{“$gt”:0}, “Company.Department.floor”:{“$type”:”int”}, “Company.Department.dname”:{“$type”:”string”}, “Company.Department.Employee.first_name”:{“$type”:”string”}, “Company.Department.Employee.last_name”:{“$type”:”string”}, “Company.Department.Employee.enumber”:{“$type”:”int”}, “Company.Department.Employee.date_of_birth”:{“$type”:”date”}, “Company.Department.Employee.position”:{“$type”:”string”}, “Company.Department.Employee.position”:{“position”:{“$exists”:false}, “Company.Department.Employee.salary”:{“$type”:”double”}}]}}); im attempting to insert the following data db.task3.insert( { “Company”:{ “cname”:”Google”, “city”:”Sydney”, “street”:”Pitt Street”, “bldg#”:NumberInt(100), “budget”: 100000.0, “Department”:{ “dname”:”Google”, “floor”:NumberInt(4), “Employee”: {“first_name” : “George”, “last_name”: “Martin”, “enumber”…

Can Update document with mongodb query but not work when do in mongoose

My collection is like this: https://mongoplayground.net/p/91InBXrUq7R With this query I can update replies.likes db.getCollection(“posts”).updateOne( { “_id”: ObjectId(“5da832caeb173112348e509b”), //posts._id “comments.replies._id”:ObjectId(“5db6a88f7c6cfb0d0c2b689b”),//replies._id }, { “$push”: { “comments.$[outer].replies.$[inner].likes”: “10000012” } }, { “arrayFilters”: [ { “outer._id”: ObjectId(“5db06e11d0987d0aa2cd5593”) },//comments._id { “inner._id”: ObjectId(“5db6a88f7c6cfb0d0c2b689b”) }//replies._id ] } ) But when I code using mongoose, express, collection not update //Like Reply toggle router.post(“/toggleLikeReply”,…

How handle i18n(with fallback) on MongoDB when translation is in another Collection?

Given these excerpt collections: Translation Collection [ { “_id”: “id01_name”, “text”: “Item’s Name” }, { “_id”: “id01_desc”, “text”: “Item’s lore description” }, { “_id”: “sk_id”, “text”: “Item’s skill description” }, ] Item Collection [ { “_id”: “id01”, “name”: “id01_name”, “lore_description”: “id01_desc”, “skill”: { “description”: “sk_id01”, } } ] Question: Using only mongodb driver (NO Mongo…

How Could I Write a helper function which is query from mongodb , and then can call this func for any ejs template

I want to write a function with one param id for this mongo to pass to my home.ejs. Example with this query: db.getCollection(‘users’).find(‘5da85558886aee13e4e7f044’, {image: 1}) Example I have a route. routes/users.js var User = require(“../models/user”); var db = require(“../secure/db”); var middleware = require(“../middlewares/middleware”); //… router.get(“/home”, middleware.isAllowed, function(req, res, next) { res.render(‘home’,{ title: “Project”, userList: userList,…