java - Is it possible to filter MongoDB query results? -


i developing simple web application fetches data mongodb.

what need do, show data matching query on webpage. let's user has choose

  • programming language [java, c#, python]
  • project creation time [all, max week ago, max month ago]
  • implemented algorithm [heapsort, quicksort, mergesort]

now, mongodb collection contains types of object, of not algorithm @ (this unavoidable, unfortunately).

because of fact, have specific query finds documents eligible further processing.

finditerable<document> docs = collection.find(filters.ex(programminglanguage));  

and here comes final question:

when have finditerable object, can filter specific documents selected documents chosen?

for example, need line of code, give me documents created no longer month ago written in java, given docs object.

desirably implement this:

create function applies additional filter on finditerable object

public static finditerable<document> applylastmonth(finditerable<document> docs) {     return docs.<magicfunction>(filters.gte("date", datemonthago())) } 

and apply wherever needed. possible?

my problem more complex, please not solve example given above, want able filter results returned other query, don't @ dozens of cases in code. unfortunately found out docs.filter(...) not work me, replaces old query new one.


Comments

Popular posts from this blog

qt - Using float or double for own QML classes -

Create Outlook appointment via C# .Net -

ios - Swift Array Resetting Itself -