Solved

MongoDB null value query

Posted on 2011-09-17
1
598 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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

Suggested Solutions

This article describes some very basic things about SQL Server filegroups.
APEX (Application Express) is used to develop a web application from Oracle. SQL Workshop is one of the tools that comes with Oracle APEX to query or modify the database objects or to make any changes to the structure.
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
The viewer will learn how to implement Singleton Design Pattern in Java.

813 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now