Documentation Home
X DevAPI User Guide for MySQL Shell in Python Mode
Download this Manual
PDF (US Ltr) - 1.2Mb
PDF (A4) - 1.2Mb


11.3 Collection CRUD Functions

CollectionFindFunction

The syntax for this function in EBNF is:

CollectionFindFunction
  ::= '.find(' SearchConditionStr? ')' ( '.fields(' ProjectedDocumentExprStr ')' )?
      ( '.groupBy(' SearchExprStrList ')' )? ( '.having(' SearchConditionStr ')' )?
      ( '.sort(' SortExprStrList ')' )? ( '.limit(' NumberOfRows ')' ( '.offset(' NumberOfRows ')' )? )?
      ( '.lockExclusive(' LockContention ')' | '.lockShared(' LockContention ')' )? 
      ( '.bind(' PlaceholderValues ')' )*
      ( '.execute()' )?

Figure 11.9 CollectionFindFunction

Image shows the syntax in EBNF form as described in the preceding text.

CollectionModifyFunction

The syntax for this function shown in EBNF is:

CollectionModifyFunction
  ::= '.modify(' SearchConditionStr ')'
      ( '.set(' DocPath ',' ExprOrLiteral ')' |
        '.unset(' DocPath ( ',' DocPath )* ')' |
        '.arrayInsert(' DocPath ',' ExprOrLiteral ')' |
        '.arrayAppend(' DocPath ',' ExprOrLiteral ')' |
        '.patch(' DocumentOrJSON ')'
      )+
      ( '.sort(' SortExprStrList ')' )? ( '.limit(' NumberOfRows ')' )?
      ( '.bind(' PlaceholderValues ')' )*
      ( '.execute()' )?

Figure 11.10 CollectionModifyFunction

Image shows the syntax in EBNF form as described in the preceding text.

CollectionAddFunction

The syntax for this function shown in EBNF is:

CollectionAddFunction
    ::= ( '.add(' ( DocumentOrJSON | '[' DocumentOrJSON ( ',' DocumentOrJSON )* ']' )? ')' )+
        ( '.execute()' )?

Figure 11.11 CollectionAddFunction

Image shows the syntax in EBNF form as described in the preceding text.

CollectionRemoveFunction

The syntax for this function shown in EBNF is:

CollectionRemoveFunction
    ::= '.remove(' SearchConditionStr ')'
        ( '.sort(' SortExprStrList ')' )? ( '.limit(' NumberOfRows ')' )?
        ( '.bind(' PlaceholderValues ')' )*
        ( '.execute()' )?

Figure 11.12 CollectionRemoveFunction

Image shows the syntax in EBNF form as described in the preceding text.