Database
db={"issues":[{"_id":ObjectId("50abae61edecb53c740022eb"),"pull_request":{"diff_url":null,"patch_url":null,"html_url":null}},{"_id":ObjectId("50abae61edecb53c740022ec"),"pull_request":{"diff_url":"https://github.com/joyent/http-parser/pull/106.diff","patch_url":"https://github.com/joyent/http-parser/pull/106.patch","html_url":"https://github.com/joyent/http-parser/pull/106"}},{"_id":ObjectId("50abae61edecb53c740022ed"),"pull_request":{}},{"_id":ObjectId("50abae61edecb53c740022ee"),"pull_request":null}]}
Query
db.issues.aggregate([{$addFields:{hasPullRequest:{$cond:[{$or:[{$eq:["$pull_request",null]},{$eq:[{$size:{$objectToArray:"$pull_request"}},0]},{$ne:[{$size:{$objectToArray:"$pull_request"}},{$size:{$filter:{input:{$objectToArray:"$pull_request"},cond:{$ne:["$$this.v",null]}}}}]}]},false,true]}}}])