2017-01-25 1 views
0

"eagle"というmongodbデータベースがあり、 "[email protected]"のすべての電子メールレコードを "[email protected]"(コレクション内のすべてのコレクションワシ 『または『ハヤブサ』」。すべてのmongodbコレクション内の文字列を検索して置き換えます

db.eagle.find({}).forEach(function(e,i) { 
    e.email=e.email.replace("//[email protected]","//[email protected]"); 
    db.eagle.save(e); 
}); 

私はので、私は私がでてることさえわからない... MongoDBのために非常に新しいです』 ......私はただのmongoを実行します。このクエリは、」doesnのtは何かをここで

は私のコミュニケーションオブジェクトがどのように見えるかです:。

{ 
    "_id" : ObjectId("redacted"), 
    "timestamp" : ISODate("2016-08-03T15:08:07.000Z"), 
    "thread_index" : "", 
    "updated_at" : ISODate("2016-09-01T17:49:31.401Z"), 
    "from" : { 
     "username" : "None", 
     "name" : "Pinky Jones", 
     "email" : "[email protected]" 
    }, 
    "to" : { 
     "username" : "redude", 
     "name" : "Red Baron", 
     "email" : "[email protected]" 
    }, 
    "created_at" : ISODate("2016-09-01T17:49:31.401Z"), 

} 

答えて

関連する問題