2

を使用して、新しいレコードまたは古いレコードのどちらで作業しているかを検出することは可能mgoですか?

私が言いたいことの例は、Rails ActiveRecord で実装されています。

object.new_record?

4

2 に答える 2

0

どうやらそうではありません。

mgoのコードを見ると、ドキュメント*saved*と比較して" " 関数が表示されません。ActiveRecord::Persistence.new_record?

このオブジェクトがまだ保存されていない場合、つまり、オブジェクトのレコードがまだデータ ストアに存在しない場合は true を返します。それ以外の場合は false を返します。

私は見ますmgo

C:\Users\vonc\prog\git\mgo>gi saved
gridfs.go:360:// SetChunkSize sets size of saved chunks.  Once the file is written to, it
gridfs.go:361:// will be split in blocks of that size and each block saved into an
txn/txn.go:360:// Saved documents are in the format:

そして、 any を探しても、IsXxxx()関連するものは何も得られません (主にIsMasterまたはIsDup)

于 2014-09-24T16:33:55.660 に答える