Skip to content

Instantly share code, notes, and snippets.

@mugan86
Created April 11, 2020 09:00
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mugan86/23dbbe7a55d85ead82a6b119aed8604e to your computer and use it in GitHub Desktop.
Save mugan86/23dbbe7a55d85ead82a6b119aed8604e to your computer and use it in GitHub Desktop.
Añadiré las consultas para hacer inner join con MongoDB
Obtener los nombres de los datos principales del producto, limitado a 5 y que sean plataforma PC
db.products_platforms.aggregate( [{ $lookup: { from: 'products', localField: 'product_id', foreignField: 'id', as: 'info_general' } }, {$match: {platform_id: '4'}}, { $project: { product_id: 0 } }, {$limit: 5}]).pretty()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment