私はnode.jsとmongodbを学んでいます。アプリでmongoskinモジュールを使用していますが、「アップサート」機能を動作させることができないようです。
githubで(かなり不透明な)mongoskinガイドを読みました。これが私がこれまでに試したことです:
// 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);
「存在しない場合は更新または挿入」機能を作成するにはどうすればよいですか?