MongoDB & Java Driver: Range Query -



MongoDB & Java Driver: Range Query -

i have database of documents contain numerical field x. attempting write query returns specified number of documents x fields closest given value y.

e.g. list of x documents [1, 4, 9, 2, 5, 4, 6, 8, 9, 10, 23, 2] y 5, specified number of results homecoming 6 homecoming [4, 4, 5, 6, 8, 9]

my initial thought of documents, sort result set x, , trim excess entries around y. i'm not sure how implement "trimming" functionality in mongo, however.

how can go crafting query using java driver this?

there nil mongodb help you. have implement such filtering on application level or perhaps utilize map-reduce standard client-side query api not help here (unlikely implement using sql).

java mongodb

Comments

Popular posts from this blog

java - How to pass parameters between Request-Scoped Controllers? -

string - what is the difference between "some" == "some\0" and strcmp("some","some\0") in c++? -

actionscript 3 - Flex: moving a point with rotation doesnt change the point XY? -