python (65.1k questions)
javascript (44.2k questions)
reactjs (22.7k questions)
java (20.8k questions)
c# (17.4k questions)
html (16.3k questions)
r (13.7k questions)
android (12.9k questions)
How to sort an array of `$lookup` result by `Date` field
I'm trying to sort an array (descending) that gets computed through a $lookup by a field called createdAt which contains a Date object:
[
{
"$lookup": {
"from": &...
Viriato
Votes: 0
Answers: 1
Mongodb aggregate lookup with size
I want to know the document size/number when user do the filtering
For example,
Restaurant A has 5 dishes on the menu
Restaurant B has 10 dishes on the menu
Restaurant C has 15 dishes on the menu
Re...
Alan Tang
Votes: 0
Answers: 1
Mongodb query: getting join of docs only if satisfies a specific condition
I want to have the mongodb query given these details below, and to have best in performance.
Let me start by an example:
Let me have a collection,
/// the collection
services =
[
{
_id: obj(id...
dev313m
Votes: 0
Answers: 3
How to match documents of same collection in a lookup where an array field has the highest number of matching elements?
I have a products collection with a schema as follows:
{
brand: String,
category: String,
title: String,
description: String,
product_variants: [...],
tags: [{label:String}...
Ahnaf Ahmed
Votes: 0
Answers: 0