2012-04-28 2 views
5

나는 node.js와 mongodb를 배우고 있습니다. 내 응용 프로그램에서 mongoskin 모듈을 사용하고 있지만 작동하도록 "upsert"기능을 사용할 수 없습니다.몽고 스킨 (node.js 및 mongodb)으로 업다운

나는 github에서 (다소 불투명 한) 몽고 스킨 가이드를 읽었습니다. 다음은 지금까지 시도한 내용입니다.

// this works. there's an insert then an update. The final "x" is "XX". 
db.collection("stuff").insert({a:"A"}, {x:"X"}); 
db.collection("stuff").update({a:"A"}, {x:"XX"}); 

// this does NOT work. I thought it would do an upsert, but nothing. 
db.collection("stuff").update({b:"B"}, {y:"YY"}, true); 

"업데이트 또는 삽입하지 않을 경우 삽입"기능을 어떻게 만들 수 있습니까?

답변