背景: この問題は、Mongo シェル (2.2.2) では見えない DBRefs の _doctrine_class_name フィールドを使用する Doctrine ODM で発生し、レコードを手動で更新する必要があったときにかなりの問題を引き起こしました。
例:
mongoshell> use testdb; // for safety
mongoshell> a = DBRef("layout_block", ObjectId("510a71fde1dc610965000005")); // create a dbref
mongoshell> a.hiddenfield = "whatever" // add a field that's normally not there like Doctrine does
mongoshell> a // view it's contents, you won't see hiddenfield
mongoshell> for (k in a) { var val = a[k]; print( k + "(" + typeof(val) + "): " + val ); } // you can see that there's more if you iterate through it
mongoshell> db.testcoll.save({ref: [ a ]}) // you can have it in a collection
mongoshell> db.testcoll.findOne(); // and normally you won't see it
以下の 3 番目のコマンド (または MongoVue) のような反復がなければ、単純に find() を使用しただけでは、DBRef にそれ以上のものがあることを知ることはできません。find() の使用可能な修飾子が見つかりませんでした (試した: toArray、tojson、printjson、toString、hex、base64、pretty、chatty、verbose、...)。
DBRef の内容を mongo シェルで詳細に表示する方法を持っている人はいますか?