Database

db={"bookSchema":[{_id:ObjectId("637d05dc32428ed75ea08d09"),book_details:{book_subscription:null,book_auth:"Amber"},book_name:"random123"},{_id:ObjectId("637d0673ce0f17f6c473dee2"),book_details:{book_subscription:ObjectId("637d06a545a17f0e686ecf3a"),book_auth:"Shurya"},book_name:"random321"},{_id:ObjectId("637d069a3d597c8458ebe4ec"),book_details:{book_subscription:ObjectId("637d06ac82f0760b03fdea0d"),book_auth:"Aman"},book_name:"random676"},{_id:ObjectId("637d06c05b32d503007bcb54"),book_details:{book_subscription:null,book_auth:"Saurav"},book_name:"random999"},]}

Query

db.bookSchema.aggregate([{"$addFields":{"book_count":{"$cond":{"if":{"$not":["book_details.book_subscription",null]},"then":1,"else":0}}}}])

Result