Docs Menu
Docs Home
/ /
Atlas Device SDK
/ / /

ํด๋ž˜์Šค FindOneAndModifyOptions

์ด ํŽ˜์ด์ง€์˜ ๋‚ด์šฉ

  • io.realm.mongodb.mongo.options
  • ์ƒ์„ฑ์ž
  • ๋ฉ”์„œ๋“œ ์š”์•ฝ
  • ์ƒ์†๋œ ๋ฉ”์„œ๋“œ
  • ์ƒ์„ฑ์ž ์„ธ๋ถ€ ์ •๋ณด
  • ๋ฉ”์„œ๋“œ ์„ธ๋ถ€ ์ •๋ณด
  • getProjection
  • getSort
  • isReturnNewDocument
  • isUpsert
  • ํ”„๋กœ์ ์…˜
  • returnNewDocument
  • sort
  • toString
  • ์—…์„œํŠธ
java.lang.Object
io.realm.mongodb.mongo.options.FindOneAndModifyOptions

findOneAndUpdate, findOneAndReplace ๋˜๋Š” findOneAndDelete ์ž‘์—…(์ผ๋ฐ˜์ ์œผ๋กœ findOneAndModify ์ž‘์—…์ด๋ผ๊ณ ๋„ ํ•จ)์— ์ ์šฉํ•  ์˜ต์…˜์ž…๋‹ˆ๋‹ค.

์ƒ์„ฑ์ž ๋ฐ ์„ค๋ช…
์ˆ˜์ •์ž ๋ฐ ์œ ํ˜•
๋ฉ”์„œ๋“œ ๋ฐ ์„ค๋ช…
๊ณต๊ฐœ BSON

์ผ์น˜ํ•˜๋Š” ๋ชจ๋“  ๋ฌธ์„œ์— ๋Œ€ํ•ด ๋ฐ˜ํ™˜ํ•  ํ•„๋“œ๋ฅผ ์„ค๋ช…ํ•˜๋Š” ๋ฌธ์„œ๋ฅผ ๊ฐ€์ ธ์˜ต๋‹ˆ๋‹ค.

๊ณต๊ฐœ BSON

์ฟผ๋ฆฌ์— ์ ์šฉํ•  ์ •๋ ฌ ๊ธฐ์ค€์„ ๊ฐ€์ ธ์˜ต๋‹ˆ๋‹ค.

๊ณต๊ฐœ ๋ถ€์šธ

findOneAndModify ์ž‘์—…์—์„œ ์ƒˆ ๋ฌธ์„œ๋ฅผ ๋ฐ˜ํ™˜ํ•ด์•ผ ํ•˜๋Š” ๊ฒฝ์šฐ true๋ฅผ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค.

๊ณต๊ฐœ ๋ถ€์šธ

์ฟผ๋ฆฌ ํ•„ํ„ฐ์™€ ์ผ์น˜ํ•˜๋Š” ํ•ญ๋ชฉ์ด ์—†๋Š” ๊ฒฝ์šฐ ์ƒˆ ๋ฌธ์„œ๋ฅผ ์‚ฝ์ž…ํ•ด์•ผ ํ•˜๋ฉด true๋ฅผ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค.

๊ณต๊ฐœ FindOneAndModifyOptions
Bson projection
)

์ผ์น˜ํ•˜๋Š” ๋ชจ๋“  ๋ฌธ์„œ์— ๋Œ€ํ•ด ๋ฐ˜ํ™˜ํ•  ํ•„๋“œ๋ฅผ ์„ค๋ช…ํ•˜๋Š” ๋ฌธ์„œ๋ฅผ ์„ค์ •ํ•ฉ๋‹ˆ๋‹ค.

๊ณต๊ฐœ FindOneAndModifyOptions
boolean returnNewDocument
)

findOneAndModify ์ž‘์—…์ด ์ƒˆ๋กœ ์—…๋ฐ์ดํŠธ๋œ ๋ฌธ์„œ๋ฅผ ๋ฐ˜ํ™˜ํ•ด์•ผ ํ•˜๋Š” ๊ฒฝ์šฐ true๋กœ ์„ค์ •ํ•ฉ๋‹ˆ๋‹ค.

๊ณต๊ฐœ FindOneAndModifyOptions
Bson sort
)

์ฟผ๋ฆฌ์— ์ ์šฉํ•  ์ •๋ ฌ ๊ธฐ์ค€์„ ์„ค์ •ํ•ฉ๋‹ˆ๋‹ค.

๊ณต๊ฐœ string
๊ณต๊ฐœ FindOneAndModifyOptions
boolean upsert
)

์ฟผ๋ฆฌ ํ•„ํ„ฐ์™€ ์ผ์น˜ํ•˜๋Š” ๋ฌธ์„œ๊ฐ€ ์—†๋Š” ๊ฒฝ์šฐ ์ƒˆ ๋ฌธ์„œ๋ฅผ ์‚ฝ์ž…ํ•ด์•ผ ํ•˜๋ฉด true๋กœ ์„ค์ •ํ•ฉ๋‹ˆ๋‹ค.

  • ํด๋ž˜์Šค java.lang.Object ์—์„œ ์ƒ์†๋œ ๋ฉ”์„œ๋“œ : getClass , hashCode , equals , clone , toString , notify , notifyAll , wait , wait , wait , finalize

public Bson getProjection ()

์ผ์น˜ํ•˜๋Š” ๋ชจ๋“  ๋ฌธ์„œ์— ๋Œ€ํ•ด ๋ฐ˜ํ™˜ํ•  ํ•„๋“œ๋ฅผ ์„ค๋ช…ํ•˜๋Š” ๋ฌธ์„œ๋ฅผ ๊ฐ€์ ธ์˜ต๋‹ˆ๋‹ค.

๋ฐ˜ํ™˜

ํ”„๋กœ์ ํŠธ ๋ฌธ์„œ(null์ผ ์ˆ˜ ์žˆ์Œ)

public Bson getSort ()

์ฟผ๋ฆฌ์— ์ ์šฉํ•  ์ •๋ ฌ ๊ธฐ์ค€์„ ๊ฐ€์ ธ์˜ต๋‹ˆ๋‹ค. ๊ธฐ๋ณธ๊ฐ’์€ null์ด๋ฉฐ, ์ด๋Š” ๋ฌธ์„œ๊ฐ€ ์ •์˜๋˜์ง€ ์•Š์€ ์ˆœ์„œ๋กœ ๋ฐ˜ํ™˜๋จ์„ ์˜๋ฏธํ•ฉ๋‹ˆ๋‹ค.

๋ฐ˜ํ™˜

์ •๋ ฌ ๊ธฐ์ค€์„ ์„ค๋ช…ํ•˜๋Š” ๋ฌธ์„œ

public boolean isReturnNewDocument ()

findOneAndModify ์ž‘์—…์ด ์ƒˆ ๋ฌธ์„œ๋ฅผ ๋ฐ˜ํ™˜ํ•ด์•ผ ํ•˜๋Š” ๊ฒฝ์šฐ true๋ฅผ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค. ๊ธฐ๋ณธ๊ฐ’์€ false์ž…๋‹ˆ๋‹ค. ์ฐธ๊ณ : findOneAndUpdate ๋ฐ findOneAndReplace๋งŒ ์ด ์˜ต์…˜์„ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค. findOneAndDelete๋Š” ํ•ญ์ƒ ์ด์ „ ๋ฌธ์„œ๋ฅผ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค.

๋ฐ˜ํ™˜

findOneAndModify ์ž‘์—…์ด ์ƒˆ ๋ฌธ์„œ๋ฅผ ๋ฐ˜ํ™˜ํ•ด์•ผ ํ•˜๋Š” ๊ฒฝ์šฐ true

public boolean isUpsert ()

์ฟผ๋ฆฌ ํ•„ํ„ฐ์™€ ์ผ์น˜ํ•˜๋Š” ๋ฌธ์„œ๊ฐ€ ์—†๋Š” ๊ฒฝ์šฐ ์ƒˆ ๋ฌธ์„œ๋ฅผ ์‚ฝ์ž…ํ•ด์•ผ ํ•˜๋Š” ๊ฒฝ์šฐ true๋ฅผ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค. ๊ธฐ๋ณธ๊ฐ’์€ false์ž…๋‹ˆ๋‹ค. ์ฐธ๊ณ : ์ด ์˜ต์…˜์€ findOneAndUpdate ๋ฐ findOneAndReplace๋งŒ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค.

๋ฐ˜ํ™˜

์ฟผ๋ฆฌ ํ•„ํ„ฐ์™€ ์ผ์น˜ํ•˜๋Š” ๋ฌธ์„œ๊ฐ€ ์—†์œผ๋ฉด ์ƒˆ ๋ฌธ์„œ๋ฅผ ์‚ฝ์ž…ํ•ด์•ผ ํ•˜๋Š” ๊ฒฝ์šฐ true

Bson projection
)

์ผ์น˜ํ•˜๋Š” ๋ชจ๋“  ๋ฌธ์„œ์— ๋Œ€ํ•ด ๋ฐ˜ํ™˜ํ•  ํ•„๋“œ๋ฅผ ์„ค๋ช…ํ•˜๋Š” ๋ฌธ์„œ๋ฅผ ์„ค์ •ํ•ฉ๋‹ˆ๋‹ค.

๋งค๊ฐœ๋ณ€์ˆ˜

  • projection - ํ”„๋กœ์ ํŠธ ๋ฌธ์„œ๋กœ, null์ผ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

๋ฐ˜ํ™˜

์ด

boolean returnNewDocument
)

findOneAndModify ์ž‘์—…์ด ์ƒˆ ์—…๋ฐ์ดํŠธ๋œ ๋ฌธ์„œ๋ฅผ ๋ฐ˜ํ™˜ํ•ด์•ผ ํ•˜๋Š” ๊ฒฝ์šฐ true๋กœ ์„ค์ •ํ•ฉ๋‹ˆ๋‹ค. ์ด ์ž‘์—…์„ ์ˆ˜ํ–‰ํ•˜๋ฉด ์—…๋ฐ์ดํŠธ ์ „์˜ ๋ฌธ์„œ๊ฐ€ ๋ฐ˜ํ™˜๋˜๋„๋ก ํ•˜๋ ค๋ฉด false๋กœ ์„ค์ • / ๋น„์›Œ ๋‘ก๋‹ˆ๋‹ค. ์ฐธ๊ณ : ์ด ์˜ต์…˜์€ findOneAndUpdate ๋ฐ findOneAndReplace๋งŒ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค. findOneAndDelete๋Š” ํ•ญ์ƒ ์ด์ „ ๋ฌธ์„œ๋ฅผ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค.

๋งค๊ฐœ๋ณ€์ˆ˜

  • returnNewDocument - findOneAndModify ์ž‘์—…์ด ์—…๋ฐ์ดํŠธ๋œ ๋ฌธ์„œ๋ฅผ ๋ฐ˜ํ™˜ํ•ด์•ผ ํ•˜๋Š” ๊ฒฝ์šฐ true

๋ฐ˜ํ™˜

์ด

Bson sort
)

์ฟผ๋ฆฌ์— ์ ์šฉํ•  ์ •๋ ฌ ๊ธฐ์ค€์„ ์„ค์ •ํ•ฉ๋‹ˆ๋‹ค.

๋งค๊ฐœ๋ณ€์ˆ˜

  • sort - ์ •๋ ฌ ๊ธฐ์ค€์œผ๋กœ, null์ผ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

๋ฐ˜ํ™˜

์ด

boolean upsert
)

์ฟผ๋ฆฌ ํ•„ํ„ฐ์™€ ์ผ์น˜ํ•˜๋Š” ๋ฌธ์„œ๊ฐ€ ์—†๋Š” ๊ฒฝ์šฐ ์ƒˆ ๋ฌธ์„œ๋ฅผ ์‚ฝ์ž…ํ•ด์•ผ ํ•˜๋ฉด true๋กœ ์„ค์ •ํ•ฉ๋‹ˆ๋‹ค.

๋งค๊ฐœ๋ณ€์ˆ˜

  • upsert - ์ฟผ๋ฆฌ ํ•„ํ„ฐ์™€ ์ผ์น˜ํ•˜๋Š” ๋ฌธ์„œ๊ฐ€ ์—†๋Š” ๊ฒฝ์šฐ ์ƒˆ ๋ฌธ์„œ๋ฅผ ์‚ฝ์ž…ํ•ด์•ผ ํ•˜๋ฉด true์ž…๋‹ˆ๋‹ค.

๋ฐ˜ํ™˜

์ด

๋Œ์•„๊ฐ€๊ธฐ

์นด์šดํŠธ ์˜ต์…˜