Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

MongoDB null value query

Posted on 2011-09-17
1
610 Views
Last Modified: 2016-02-10
Hi,

There are records in one of my Mongodb collection 'exmple' (please see attached code).

I would like to have Java queries so that I can get the records for each of the following scenarios:

1) records whose "nextfetchtime" field is not exist;

2) records whose "nextfetchtime" field has value of null;

Thanks.
{ "_id" : { "$oid" : "4e72eac3e4b0a2c48b0eb84d"} , "code" : "5g9a4gini94404mp1inoip5ni4gpcgn4gnin50i0ci5a0n95g555o4pgg1m45o15" , "path" : "/data2/data/htmlsource/2011-09-16/dianpingcom/" , "finishtime" : 1316154241099 , "nextfetchtime" : 1318746051658 , "codeTime" : 1316154051696 , "predicted" : false}
{ "_id" : { "$oid" : "4e7564247af2f2aa38b3fbe8"} , "code" : "mw2Da0toDk6xhkz6IVNxmEQSsQ3nLnJ84Ccxvw0734i5Hv5auTHk5aQtmUq1KxhY" , "path" : "c:/data/berkeley/database/parsedcodedb-bak/2011-07-03/dianping" , "finishtime" : 1316316196568}
{ "_id" : { "$oid" : "4e7564377af2587c0e06e5df"} , "code" : "fl6Q3Nw3BCMrX5LxHoY49llQ81vfYtW0yTGec9arAHYch8yvDvGPJ37LOzKwOOgc" , "path" : "c:/data/berkeley/database/parsedcodedb-bak/2011-07-03/dianping" , "finishtime" : 1316316215222}
{ "_id" : { "$oid" : "4e7568e07af237357a034671"} , "code" : "QfDfFpWqBHAtJYkJbMdTWFl5UrLx6lp96bdOFGzIOs0m1RlqRPxhIC0RA9ONB2yh" , "path" : "c:/data/berkeley/database/parsedcodedb-bak/2011-07-03/dianping" , "finishtime" : 1316317408821 , "nextfetchtime" :  null }

Open in new window

0
Comment
Question by:wsyy
1 Comment
 
LVL 59

Accepted Solution

by:
Kevin Cross earned 125 total points
ID: 36556761
Hi.

Is this a homework assignment?

In any case, if you are going to be working with Java and MongoDB, you probably want to start with the tutorial here: http://www.mongodb.org/display/DOCS/Java+Tutorial

The first step is get the MongoDB Java Driver. This API reference along with the tutorial should be helpful.

Hope that helps!

Please give the code a try yourself first, then post back specific challenges you are having. If it is a compilation or run-time error please post details. For the latter, please post the full stack trace to a code snippet. If the issue is the code runs, but does not yield the proper output, please give an sample with current results alongside expected ones.

We can guide you from there. This way, you will "learn" what you need going forward.

Best regards and happy coding,

Kevin
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
difference between sorce folder and folder in eclipise 3 28
java imports not found 4 24
Database ERD 4 26
Exchange 2013 weird behavior 6 33
CCModeler offers a way to enter basic information like entities, attributes and relationships and export them as yEd or erviz diagram. It also can import existing Access or SQL Server tables with relationships.
Creating and Managing Databases with phpMyAdmin in cPanel.
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question