Geeks, please accept the hero post of 2021 Microsoft x Intel hacking contest>>>
The article is from my blog: https://www.lwxshow.com/db/mongo/detection-field-exists-in-mongodb.html
#Find the column containing post and test whether the column containing post exists
In mongodb, check whether the field exists
or not
db.cuser.find({post:{$ exists:1 }});
{ “_ id” : ObjectId(“51a23348ea214a8ee3204de1”), “age” : 1, “name” : “userid_ 1”, “post” : [ 1, 2, 3, 4, 5 ], “pwd” : “pwd_ 1” }