Note that there are some explanatory texts on larger screens.

plurals
  1. POparse a particular amount of data from json file using mongodb and java
    text
    copied!<p>I am using mongodb in java for one of my projects. User is going to enter a time which he knows will be in the json file. What I want to do is search for the document which contains that time and from that document till the next LoginRequest document all documents are to be produced as an output.</p> <pre><code> For example: { "_id" : { "$oid" : "4ceb753a70fdf877ef5113ca"}, "LoginRequest" : { "Time" : "11-06-2012 11:59:33", "innerAttr4" : "innerValue4"} } { "_id" : { "$oid" : "4ceb753a70fdf877ef5113cc"}, "LoginResponse" : { "innerAttr1" : "innerValue1", "innerAttr4" : "innerValue4"} } { "_id" : { "$oid" : "4ceb753a70fdf877ef5113cb"}, "OtherRequest" : { "innerAttr3" : "innerValue3"} } { "_id" : { "$oid" : "4ceb753a70fdf877ef5113cd"}, "OtherResponse" : { "innerAttr2" : "innerValue2", "innerAttr4" : "innerValue4"} } { "_id" : { "$oid" : "4ceb753a70fdf877ef5113ce"}, "LoginRequest" : { "Time" : "11-06-2012 12:34:05", "innerAttr4" : "innerValue4"} } { "_id" : { "$oid" : "4ceb753a70fdf877ef5113cf"}, "LoginResponse" : { "innerAttr1" : "innerValue1", "innerAttr4" : "innerValue4"} } { "_id" : { "$oid" : "4ceb753a70fdf877ef5113cg"}, "OtherRequest" : { "innerAttr3" : "innerValue3"} } { "_id" : { "$oid" : "4ceb753a70fdf877ef5113ci"}, "LoginRequest" : { "Time" : "11-06-2012 14:59:33", "innerAttr4" : "innerValue4"} } { "_id" : { "$oid" : "4ceb753a70fdf877ef5113cm"}, "LoginResponse" : { "innerAttr1" : "innerValue1", "innerAttr4" : "innerValue4"} } { "_id" : { "$oid" : "4ceb753a70fdf877ef5113cj"}, "OtherRequest" : { "innerAttr3" : "innerValue3"} } { "_id" : { "$oid" : "4ceb753a70fdf877ef5113cs"}, "OtherResponse" : { "innerAttr2" : "innerValue2", "innerAttr4" : "innerValue4"} } </code></pre> <p>Here suppose user enters time as "11-06-2012 12:34:05". So the output for this should be:</p> <pre><code>Output: { "_id" : { "$oid" : "4ceb753a70fdf877ef5113ce"}, "LoginRequest" : { "Time" : "11-06-2012 12:34:05", "innerAttr4" : "innerValue4"} } { "_id" : { "$oid" : "4ceb753a70fdf877ef5113cf"}, "LoginResponse" : { "innerAttr1" : "innerValue1", "innerAttr4" : "innerValue4"} } { "_id" : { "$oid" : "4ceb753a70fdf877ef5113cg"}, "OtherRequest" : { "innerAttr3" : "innerValue3"} } </code></pre> <p>I am able to get <code>{ "_id" : { "$oid" : "4ceb753a70fdf877ef5113ce"}, "LoginRequest" : { "Time" : "11-06-2012 12:34:05", "innerAttr4" : "innerValue4"} }</code> as an output but I want the output to be as mentioned above.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload