PDF (US Ltr) - 1.4Mb
PDF (A4) - 1.4Mb
值表達式字串用於計算值,然後可以將該值指派給指定的欄位或資料行。這對於 modify()
和 update()
,以及在插入時計算文件中的值是必要的。
值表達式字串的範例使用方法是遞增計數器。expr()
函式用於包裝字串,否則這些字串會被逐字解譯。例如,要遞增計數器
// the expression is evaluated on the server
collection.modify('true').set("counter", expr("counter + 1")).execute()
如果您不使用 expr()
包裝字串,它會將文字字串「counter + 1」指派給「counter」成員
// equivalent to directly assigning a string: counter = "counter + 1"
collection.modify('true').set("counter", "counter + 1").execute()