def insertImage(self, owner, path, name, description, location, tags):
     mongodb = images.Images()
     query = {
         "owner": owner,
         "picture": path,
         "name": name,
         "description": description,
         "location": location,
         "tags": tags
     }
     result = mongodb.create(query)
     return result
    def getByFilter(self, lugar, usuario, tag):
        mongodb = images.Images()
        i_filter = {}

        if lugar == "" and tag == "" and usuario != "":
            i_filter = {"owner": usuario}
        elif lugar != "" and tag == "" and usuario == "":
            i_filter = {"location": lugar}
        elif lugar != "" and tag == "" and usuario != "":
            i_filter = {"location": lugar, "owner": usuario}
        elif lugar == "" and tag != "" and usuario == "":
            i_filter = {"tags": tag}
        elif lugar == "" and tag != "" and usuario != "":
            i_filter = {"owner": usuario, "tags": tag}
        elif lugar != "" and tag != "" and usuario == "":
            i_filter = {"location": lugar, "tags": tag}
        elif lugar != "" and tag != "" and usuario != "":
            i_filter = {"location": lugar, "owner": usuario, "tags": tag}

        allImages = mongodb.findAllWithFilter(i_filter)
        return allImages
    def removeSpecificImage(self, title, owner):
        mongodb = images.Images()
        query = {"name": title, "owner": owner}

        mongodb.deleteByFilter(query)
 def get(self):
     mongodb = images.Images()
     allImages = mongodb.findAll()
     return allImages
 def removeImage(self, owner):
     mongodb = images.Images()
     mongodb.deleteAll(owner)