> db.choice.findOne()
> db.choice.find({"_id":"005a38d5"})> db.choice.find({"_id":"005a38d5"},{"title":1,"results":1})
{ "_id" : "005a38d5", "title" : "While some maintain that the recent proliferati
on of uncredited web sources will have a(n) (i)_____ effect on scholarship, othe
rs argue that the effects will be far more (ii)_____, claiming that academics ar
e sensible enough not to (iii)_____ unattributed sources.", "results" : [  [  "1
" ],  [  "1" ],  [  "0" ] ] }
>> db.choice.find({"_id":"005a38d5"},{"title":1,"results":1,"_id":0})
{ "title" : "While some maintain that the recent proliferation of uncredited web
sources will have a(n) (i)_____ effect on scholarship, others argue that the ef
fects will be far more (ii)_____, claiming that academics are sensible enough no
t to (iii)_____ unattributed sources.", "results" : [  [  "1" ],  [  "1" ],  [
"0" ] ] }
>> db.choice.findOne({"blankCount":{$lte:2,$gte:1}},{"blankCount":1})
{ "_id" : "006526ff", "blankCount" : 2 }
>> db.choice.findOne({$or:[{"blankCount":2},{"type":3}]})> db.choice.findOne({"type":{"$not":{$gt:3}}})> db.questionSet.findOne({source:null})> db.questionSet.findOne({source:null,$exists:true})> db.choice.findOne({title:/^While/})> db.questionSet.findOne({"questionIds":'6188e9fc'},{"questionIds":1})
{
        "_id" : "030eeeba",
        "questionIds" : [
                "6188e9fc",
                "a380e38c",
                "addff709",
                "b6bc4eff",
                "5095b99f",
                "c8352e48",
                "ecca3626",
                "c31125f7"
        ]
}
> db.questionSet.findOne({"questionIds":{$all:['6188e9fc','a380e38c']}},{"questi
onIds":1})
{
        "_id" : "030eeeba",
        "questionIds" : [
                "6188e9fc",
                "a380e38c",
                "addff709",
                "b6bc4eff",
                "5095b99f",
                "c8352e48",
                "ecca3626",
                "c31125f7"
        ]
}> db.questionSet.findOne({"questionIds":['6188e9fc','a380e38c']},{"questionIds":
1})
null> db.questionSet.findOne({},{"questionIds":{$slice:3}})
{
        "_id" : "030eeeba",
        "catQuestionSet" : 2,
        "orderNo" : 2,
        "source" : 1,
        "type" : 2,
        "level" : 3,
        "questionCount" : 10,
        "questionIds" : [
                "6188e9fc",
                "a380e38c",
                "addff709"
        ]
}
> db.questionSet.findOne({},{"questionIds":{$slice:-3}})
{
        "_id" : "030eeeba",
        "catQuestionSet" : 2,
        "orderNo" : 2,
        "source" : 1,
        "type" : 2,
        "level" : 3,
        "questionCount" : 10,
        "questionIds" : [
                "c8352e48",
                "ecca3626",
                "c31125f7"
        ]
}
> db.choice.findOne({"explain":{"ccurlList":"3DC334A16B187EBF9C33DC5901307461","
textExplain":"Answers"}})
> db.choice.findOne({"explain.ccurlList":"3DC334A16B187EBF9C33DC5901307461","exp
lain.textExplain":"Answers"})
> db.choice.findOne({"explain":{$elemMatch:{"ccurlList":"3DC334A16B187EBF9C33DC5
901307461","textExplain":"Answers"}}})
> db.choice.findOne({$where:"this.blankCount==this.type"})
{
        "_id" : "005a38d5",
        "blankCount" : 3,
        "explain" : {
                "ccurlList" : [ ]
        },
        "type" : 3,
        "questionSetId" : "affccc14"     
}
原文地址:http://blog.csdn.net/liuchangqing123/article/details/44342425