Ghini / ghini.web

web and geo interface to ghini.desktop database
GNU Affero General Public License v3.0
4 stars 1 forks source link

server should send client information about presence of species per garden #17

Closed mfrasca closed 7 years ago

mfrasca commented 7 years ago

something like this, and who knows better please tell me better.

db.plants.aggregate({$group: {_id: {species:"$species", garden: "$garden"}, count: {$sum: 1}}}, 
        {$project: {species: "$_id.species", garden: "$_id.garden", count: 1}}, 
        {$sort: {species: 1}}, 
        {$group: {_id: {species:"$species"}, garden: {$push: "$garden"}, count: {$push: "$count"}}})
mfrasca commented 7 years ago

or, less redundant:

db.plants.aggregate(
    {$group: {_id: {species:"$species", garden: "$garden"}, count: {$sum: 1}}},
    {$group: {_id: {species:"$_id.species"}, garden: {$push: "$_id.garden"}, count: {$push: "$count"}}})
mfrasca commented 7 years ago

this is done, now the user interface