Skip to content

A repository made to host and hold the lab practices of DataBases 2 subject from Universidad Argentina De la Empresa(UADE). It contains the scripts of a MongoDB for its creation, modification and querys.

Notifications You must be signed in to change notification settings

Ignacioals/BD2-MongoDB

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 

Repository files navigation

BD2-MongoDB

archivoCargaDatosESTRUCTURADO.js

  1. Get into the mongo terminal by typing in the shell mongo.
  2. Load the .js file from the pathfile using the command load("file path of archivoCargaDatosESTRUCTURADO.js")
  3. set the database with use inversionesDB

Querys

You can do such querys as:

  1. Get the investments with the most operations. Copy the text into the shell and press enter db.inversiones.aggregate({$unwind: "$operaciones"}, {$group: {_id: "$nombre", cantOperaciones: {$sum:1}}}, {$sort: {cantOperaciones: -1}}, {$limit: 1})
  2. Get the adviser with the most recommendations for a determined investment. Copy the text into the shell and press enter db.inversiones.aggregate({$match: {nombre: "Apple"}}, {$unwind: "$operaciones"}, {$group: {_id: "$operaciones.asesor.nombre", cantRecomendaciones: {$sum:1}}}, {$sort: {cantRecomendaciones: -1}}, {$limit: 1})
  • this will specifically search in the investments of "Apple", you can also do this with any other investment by declaring a variable with the name of the investments you want to get.
  • set the input var inversion = "[anyInvestmentYouWant]"
  • Copy the text into the shell and press enter db.inversiones.aggregate({$match: {nombre: inversion}}, {$unwind: "$operaciones"}, {$group: {_id: "$operaciones.asesor.nombre", cantRecomendaciones: {$sum:1}}}, {$sort: {cantRecomendaciones: -1}}, {$limit: 1})

About

A repository made to host and hold the lab practices of DataBases 2 subject from Universidad Argentina De la Empresa(UADE). It contains the scripts of a MongoDB for its creation, modification and querys.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published