Components All New MacOS Windows Linux iOS
Examples Mac & Win Server Client Guides Statistic FMM Blog Deprecated Old

MBS FileMaker Plugin Example Databases

MongoDB Blog

All examples are included with download of MBS FileMaker Plugin.

MongoDB Blog.fmp12

Overview
Tables1
Relationships0
Layouts1
Scripts24
Value Lists0
Custom Functions0
Custom Menus24
File Options
Default custom menu set[Standard FileMaker Menus]
When opening file
Minimum allowed version12.0
Login usingAccount Name; Account= Admin
Allow user to save passwordOff
Require iOS passcodeOff
Switch to layoutOff
Hide all toolbarsOff
Script triggers
OnFirstWindowOpenOff
OnLastWindowCloseOff
OnWindowOpenOff
OnWindowCloseOff
OnFileAVPlayerChangeOff
Thumbnail Settings
Generate ThumbnailsOn; Temporary

 

Tables

Table Name
Statistics
Occurrences in Relationship Graph
MongoDB
13 fields defined, 1 record
MongoDB

Fields

Table Name: MongoDB - 13 Fields
Field NameTypeOptionsCommentsOn LayoutsIn RelationshipsIn ScriptsIn Value Lists
PrimaryKeyNormal, TextAuto-Enter:
  • Context table: MongoDB
    Calculation: Get( UUID )
Validation:
  • Only during data entry
  • Not empty
  • Unique
  • Strict validation
Storage:
  • Repetitions: 1
  • Indexing: Minimal
  • Automatically create indexes as needed
  • Index Language: Unicode Raw
Unique identifier of each record in this table
          CreationTimestampNormal, TimestampAuto-Enter:
          • Creation timestamp
          Validation:
          • Only during data entry
          • Strict data type: 4 digit year
          • Not empty
          • Strict validation
          Storage:
          • Repetitions: 1
          • Indexing: None
          • Automatically create indexes as needed
          • Index Language: English
          Date and time each record was created
                  CreatedByNormal, TextAuto-Enter:
                  • Creation account name
                  Validation:
                  • Only during data entry
                  • Not empty
                  • Strict validation
                  Storage:
                  • Repetitions: 1
                  • Indexing: None
                  • Automatically create indexes as needed
                  • Index Language: English
                  Account name of the user who created each record
                          ModificationTimestampNormal, TimestampAuto-Enter:
                          • Modification timestamp
                          Validation:
                          • Only during data entry
                          • Strict data type: 4 digit year
                          • Not empty
                          • Strict validation
                          Storage:
                          • Repetitions: 1
                          • Indexing: None
                          • Automatically create indexes as needed
                          • Index Language: English
                          Date and time each record was last modified
                                  ModifiedByNormal, TextAuto-Enter:
                                  • Modification account name
                                  Validation:
                                  • Only during data entry
                                  • Not empty
                                  • Strict validation
                                  Storage:
                                  • Repetitions: 1
                                  • Indexing: None
                                  • Automatically create indexes as needed
                                  • Index Language: English
                                  Account name of the user who last modified each record
                                          NameNormal, TextAuto-Enter:
                                          • Allow editing
                                          Validation:
                                          • Only during data entry
                                          Storage:
                                          • Repetitions: 1
                                          • Indexing: None
                                          • Automatically create indexes as needed
                                          • Index Language: English
                                              AgeNormal, TextAuto-Enter:
                                              • Allow editing
                                              Validation:
                                              • Only during data entry
                                              Storage:
                                              • Repetitions: 1
                                              • Indexing: None
                                              • Automatically create indexes as needed
                                              • Index Language: English
                                                  URINormal, TextAuto-Enter:
                                                  • Allow editing
                                                  Validation:
                                                  • Only during data entry
                                                  Storage:
                                                  • Repetitions: 1
                                                  • Indexing: None
                                                  • Automatically create indexes as needed
                                                  • Index Language: English
                                                      CollectionNormal, TextAuto-Enter:
                                                      • Allow editing
                                                      Validation:
                                                      • Only during data entry
                                                      Storage:
                                                      • Repetitions: 1
                                                      • Indexing: None
                                                      • Automatically create indexes as needed
                                                      • Index Language: English
                                                          DatabaseNormal, TextAuto-Enter:
                                                          • Allow editing
                                                          Validation:
                                                          • Only during data entry
                                                          Storage:
                                                          • Repetitions: 1
                                                          • Indexing: None
                                                          • Automatically create indexes as needed
                                                          • Index Language: English
                                                              ResultNormal, TextAuto-Enter:
                                                              • Allow editing
                                                              Validation:
                                                              • Only during data entry
                                                              Storage:
                                                              • Repetitions: 1
                                                              • Indexing: None
                                                              • Automatically create indexes as needed
                                                              • Index Language: English
                                                                  CursorLimitNormal, TextAuto-Enter:
                                                                  • Allow editing
                                                                  Validation:
                                                                  • Only during data entry
                                                                  Storage:
                                                                  • Repetitions: 1
                                                                  • Indexing: None
                                                                  • Automatically create indexes as needed
                                                                  • Index Language: English
                                                                      CommandNormal, TextAuto-Enter:
                                                                      • Allow editing
                                                                      Validation:
                                                                      • Only during data entry
                                                                      Storage:
                                                                      • Repetitions: 1
                                                                      • Indexing: None
                                                                      • Automatically create indexes as needed
                                                                      • Index Language: English

                                                                          Layout Objects: MongoDB

                                                                          Regular Fields

                                                                          Field Name: MongoDB::URI
                                                                          Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                                                                          • Top: 93 pt
                                                                          • Left: 17 pt
                                                                          • Bottom: 114 pt
                                                                          • Right: 261 pt
                                                                          • Anchoring: Left, Top
                                                                          Field Format:
                                                                          • Edit Box
                                                                          Field Behavior:
                                                                          • Allow field to be entered: In Find mode, In Browse mode
                                                                          • Touch keyboard type: Default for Data Type
                                                                          • Go to next field using: Tab key
                                                                          Yes

                                                                          Field Name: MongoDB::Database
                                                                          Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                                                                          • Top: 140 pt
                                                                          • Left: 17 pt
                                                                          • Bottom: 161 pt
                                                                          • Right: 261 pt
                                                                          • Anchoring: Left, Top
                                                                          Field Format:
                                                                          • Edit Box
                                                                          Field Behavior:
                                                                          • Allow field to be entered: In Find mode, In Browse mode
                                                                          • Touch keyboard type: Default for Data Type
                                                                          • Go to next field using: Tab key
                                                                          Yes

                                                                          Field Name: MongoDB::Collection
                                                                          Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                                                                          • Top: 232 pt
                                                                          • Left: 17 pt
                                                                          • Bottom: 253 pt
                                                                          • Right: 261 pt
                                                                          • Anchoring: Left, Top
                                                                          Field Format:
                                                                          • Edit Box
                                                                          Field Behavior:
                                                                          • Allow field to be entered: In Find mode, In Browse mode
                                                                          • Touch keyboard type: Default for Data Type
                                                                          • Go to next field using: Tab key
                                                                          Yes

                                                                          Field Name: MongoDB::Name
                                                                          Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                                                                          • Top: 331 pt
                                                                          • Left: 17 pt
                                                                          • Bottom: 352 pt
                                                                          • Right: 261 pt
                                                                          • Anchoring: Left, Top
                                                                          Field Format:
                                                                          • Edit Box
                                                                          Field Behavior:
                                                                          • Allow field to be entered: In Find mode, In Browse mode
                                                                          • Touch keyboard type: Default for Data Type
                                                                          • Go to next field using: Tab key
                                                                          Yes

                                                                          Field Name: MongoDB::Age
                                                                          Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                                                                          • Top: 331 pt
                                                                          • Left: 277 pt
                                                                          • Bottom: 352 pt
                                                                          • Right: 521 pt
                                                                          • Anchoring: Left, Top
                                                                          Field Format:
                                                                          • Edit Box
                                                                          Field Behavior:
                                                                          • Allow field to be entered: In Find mode, In Browse mode
                                                                          • Touch keyboard type: Default for Data Type
                                                                          • Go to next field using: Tab key
                                                                          Yes

                                                                          Field Name: MongoDB::Result
                                                                          Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                                                                          • Top: 503 pt
                                                                          • Left: 17 pt
                                                                          • Bottom: 670 pt
                                                                          • Right: 501 pt
                                                                          • Anchoring: Left, Top
                                                                          Field Format:
                                                                          • Edit Box
                                                                          Field Behavior:
                                                                          • Allow field to be entered: In Find mode, In Browse mode
                                                                          • Touch keyboard type: Default for Data Type
                                                                          • Go to next field using: Tab key
                                                                          Yes

                                                                          Field Name: MongoDB::CursorLimit
                                                                          Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                                                                          • Top: 402 pt
                                                                          • Left: 17 pt
                                                                          • Bottom: 438 pt
                                                                          • Right: 116 pt
                                                                          • Anchoring: Left, Top
                                                                          Field Format:
                                                                          • Edit Box
                                                                          Field Behavior:
                                                                          • Allow field to be entered: In Find mode, In Browse mode
                                                                          • Touch keyboard type: Default for Data Type
                                                                          • Go to next field using: Tab key
                                                                          Yes

                                                                          Field Name: MongoDB::Command
                                                                          Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                                                                          • Top: 503 pt
                                                                          • Left: 508 pt
                                                                          • Bottom: 634 pt
                                                                          • Right: 744 pt
                                                                          • Anchoring: Left, Top
                                                                          Field Format:
                                                                          • Edit Box
                                                                          Field Behavior:
                                                                          • Allow field to be entered: In Find mode, In Browse mode
                                                                          • Touch keyboard type: Default for Data Type
                                                                          • Go to next field using: Tab key
                                                                          Yes

                                                                          Buttons

                                                                          Button PropertiesCoordinatesScript/Script Step
                                                                            Type:
                                                                          • Text: Connect
                                                                          • Top: 93 pt
                                                                          • Left: 289 pt
                                                                          • Bottom: 115 pt
                                                                          • Right: 417 pt
                                                                          • Anchoring: Left, Top
                                                                          Perform Script [ “Connection” ]

                                                                          Scripts:


                                                                          Button PropertiesCoordinatesScript/Script Step
                                                                            Type:
                                                                          • Text: Use Database
                                                                          • Top: 140 pt
                                                                          • Left: 289 pt
                                                                          • Bottom: 162 pt
                                                                          • Right: 417 pt
                                                                          • Anchoring: Left, Top
                                                                          Perform Script [ “UseDatabase” ]

                                                                          Scripts:


                                                                          Button PropertiesCoordinatesScript/Script Step
                                                                            Type:
                                                                          • Text: List Databases
                                                                          • Top: 140 pt
                                                                          • Left: 425 pt
                                                                          • Bottom: 162 pt
                                                                          • Right: 553 pt
                                                                          • Anchoring: Left, Top
                                                                          Perform Script [ “ListDatabases” ]

                                                                          Scripts:


                                                                          Button PropertiesCoordinatesScript/Script Step
                                                                            Type:
                                                                          • Text: Default Database
                                                                          • Top: 166 pt
                                                                          • Left: 289 pt
                                                                          • Bottom: 188 pt
                                                                          • Right: 417 pt
                                                                          • Anchoring: Left, Top
                                                                          Perform Script [ “UseDefaultDatabase” ]

                                                                          Scripts:


                                                                          Button PropertiesCoordinatesScript/Script Step
                                                                            Type:
                                                                          • Text: End Connection
                                                                          • Top: 93 pt
                                                                          • Left: 425 pt
                                                                          • Bottom: 115 pt
                                                                          • Right: 553 pt
                                                                          • Anchoring: Left, Top
                                                                          Perform Script [ “Release” ]

                                                                          Scripts:


                                                                          Button PropertiesCoordinatesScript/Script Step
                                                                            Type:
                                                                          • Text: Use Collection
                                                                          • Top: 231 pt
                                                                          • Left: 289 pt
                                                                          • Bottom: 253 pt
                                                                          • Right: 417 pt
                                                                          • Anchoring: Left, Top
                                                                          Perform Script [ “UseCollection” ]

                                                                          Scripts:


                                                                          Button PropertiesCoordinatesScript/Script Step
                                                                            Type:
                                                                          • Text: List Collections
                                                                          • Top: 231 pt
                                                                          • Left: 425 pt
                                                                          • Bottom: 253 pt
                                                                          • Right: 553 pt
                                                                          • Anchoring: Left, Top
                                                                          Perform Script [ “ListCollections” ]

                                                                          Scripts:


                                                                          Button PropertiesCoordinatesScript/Script Step
                                                                            Type:
                                                                          • Text: Current Collection
                                                                          • Top: 257 pt
                                                                          • Left: 425 pt
                                                                          • Bottom: 279 pt
                                                                          • Right: 553 pt
                                                                          • Anchoring: Left, Top
                                                                          Perform Script [ “CurrentCollection” ]

                                                                          Scripts:


                                                                          Button PropertiesCoordinatesScript/Script Step
                                                                            Type:
                                                                          • Text: New Document ( Only need Name)
                                                                          • Top: 364 pt
                                                                          • Left: 17 pt
                                                                          • Bottom: 400 pt
                                                                          • Right: 192 pt
                                                                          • Anchoring: Left, Top
                                                                          Perform Script [ “Insert One” ]

                                                                          Scripts:


                                                                          Button PropertiesCoordinatesScript/Script Step
                                                                            Type:
                                                                          • Text: Search Documents by Name
                                                                          • Top: 364 pt
                                                                          • Left: 201 pt
                                                                          • Bottom: 400 pt
                                                                          • Right: 376 pt
                                                                          • Anchoring: Left, Top
                                                                          Perform Script [ “Search by Name” ]

                                                                          Scripts:


                                                                          Button PropertiesCoordinatesScript/Script Step
                                                                            Type:
                                                                          • Text: Update first Document by Name with an Age
                                                                          • Top: 364 pt
                                                                          • Left: 385 pt
                                                                          • Bottom: 400 pt
                                                                          • Right: 560 pt
                                                                          • Anchoring: Left, Top
                                                                          Perform Script [ “UpdateOne” ]

                                                                          Scripts:


                                                                          Button PropertiesCoordinatesScript/Script Step
                                                                            Type:
                                                                          • Text: Library Version
                                                                          • Top: 93 pt
                                                                          • Left: 561 pt
                                                                          • Bottom: 115 pt
                                                                          • Right: 689 pt
                                                                          • Anchoring: Left, Top
                                                                          Perform Script [ “LibraryVersion” ]

                                                                          Scripts:


                                                                          Button PropertiesCoordinatesScript/Script Step
                                                                            Type:
                                                                          • Text: Set Limit
                                                                          • Top: 402 pt
                                                                          • Left: 122 pt
                                                                          • Bottom: 438 pt
                                                                          • Right: 192 pt
                                                                          • Anchoring: Left, Top
                                                                          Set Variable [ $$Limit; Value:MongoDB::CursorLimit ]

                                                                          Fields:


                                                                          Button PropertiesCoordinatesScript/Script Step
                                                                            Type:
                                                                          • Text: Delete first document in the collection
                                                                          • Top: 364 pt
                                                                          • Left: 569 pt
                                                                          • Bottom: 400 pt
                                                                          • Right: 744 pt
                                                                          • Anchoring: Left, Top
                                                                          Perform Script [ “DeleteOne” ]

                                                                          Scripts:


                                                                          Button PropertiesCoordinatesScript/Script Step
                                                                            Type:
                                                                          • Text: Delete Documents with the given "Name"
                                                                          • Top: 402 pt
                                                                          • Left: 569 pt
                                                                          • Bottom: 438 pt
                                                                          • Right: 744 pt
                                                                          • Anchoring: Left, Top
                                                                          Perform Script [ “DeleteWithName” ]

                                                                          Scripts:


                                                                          Button PropertiesCoordinatesScript/Script Step
                                                                            Type:
                                                                          • Text: Delete All Documents
                                                                          • Top: 440 pt
                                                                          • Left: 569 pt
                                                                          • Bottom: 476 pt
                                                                          • Right: 744 pt
                                                                          • Anchoring: Left, Top
                                                                          Perform Script [ “DeleteAll” ]

                                                                          Scripts:


                                                                          Button PropertiesCoordinatesScript/Script Step
                                                                            Type:
                                                                          • Text: Show All (in the limit)
                                                                          • Top: 440 pt
                                                                          • Left: 201 pt
                                                                          • Bottom: 476 pt
                                                                          • Right: 376 pt
                                                                          • Anchoring: Left, Top
                                                                          Perform Script [ “Show All” ]

                                                                          Scripts:


                                                                          Button PropertiesCoordinatesScript/Script Step
                                                                            Type:
                                                                          • Text: Update all Documents by Name with an Age
                                                                          • Top: 402 pt
                                                                          • Left: 385 pt
                                                                          • Bottom: 438 pt
                                                                          • Right: 560 pt
                                                                          • Anchoring: Left, Top
                                                                          Perform Script [ “UpdateMany” ]

                                                                          Scripts:


                                                                          Button PropertiesCoordinatesScript/Script Step
                                                                            Type:
                                                                          • Text: Find Collections
                                                                          • Top: 283 pt
                                                                          • Left: 425 pt
                                                                          • Bottom: 305 pt
                                                                          • Right: 553 pt
                                                                          • Anchoring: Left, Top
                                                                          Perform Script [ “FindCollections” ]

                                                                          Scripts:


                                                                          Button PropertiesCoordinatesScript/Script Step
                                                                            Type:
                                                                          • Text: Find Database
                                                                          • Top: 140 pt
                                                                          • Left: 561 pt
                                                                          • Bottom: 162 pt
                                                                          • Right: 689 pt
                                                                          • Anchoring: Left, Top
                                                                          Perform Script [ “FindDatabase” ]

                                                                          Scripts:


                                                                          Button PropertiesCoordinatesScript/Script Step
                                                                            Type:
                                                                          • Text: Server Information
                                                                          • Top: 92 pt
                                                                          • Left: 697 pt
                                                                          • Bottom: 114 pt
                                                                          • Right: 825 pt
                                                                          • Anchoring: Left, Top
                                                                          Show Custom Dialog [ Message: MBS( "MongoDB.ServerDescriptions"; $$MongoDB ); Default Button: “OK”, Commit: “Yes” ]

                                                                          Button PropertiesCoordinatesScript/Script Step
                                                                            Type:
                                                                          • Text: Count Documents
                                                                          • Top: 231 pt
                                                                          • Left: 561 pt
                                                                          • Bottom: 253 pt
                                                                          • Right: 689 pt
                                                                          • Anchoring: Left, Top
                                                                          Perform Script [ “Count” ]

                                                                          Scripts:


                                                                          Button PropertiesCoordinatesScript/Script Step
                                                                            Type:
                                                                          • Text: Replace Document with new Document
                                                                          • Top: 440 pt
                                                                          • Left: 385 pt
                                                                          • Bottom: 476 pt
                                                                          • Right: 560 pt
                                                                          • Anchoring: Left, Top
                                                                          Perform Script [ “Replace” ]

                                                                          Scripts:


                                                                          Button PropertiesCoordinatesScript/Script Step
                                                                            Type:
                                                                          • Text: Database Command
                                                                          • Top: 638 pt
                                                                          • Left: 508 pt
                                                                          • Bottom: 670 pt
                                                                          • Right: 744 pt
                                                                          • Anchoring: Left, Top
                                                                          Perform Script [ “DatabaseCommand” ]

                                                                          Scripts:


                                                                          Button PropertiesCoordinatesScript/Script Step
                                                                            Type:
                                                                          • Text: Show Documents with an age less then 20
                                                                          • Top: 402 pt
                                                                          • Left: 201 pt
                                                                          • Bottom: 438 pt
                                                                          • Right: 376 pt
                                                                          • Anchoring: Left, Top
                                                                          Perform Script [ “Search by Age” ]

                                                                          Scripts:


                                                                          Script Hierarchy

                                                                          FindCollections
                                                                          FindDatabase
                                                                          UseCollection
                                                                          UpdateOne
                                                                          UpdateMany
                                                                          SetCursorLimit
                                                                          CurrentCollection
                                                                          Connection
                                                                          ListDatabases
                                                                          UseDatabase
                                                                          Release
                                                                          LibraryVersion
                                                                          ListCollections
                                                                          Replace
                                                                          UseDefaultDatabase
                                                                          Insert One
                                                                          DeleteAll
                                                                          DeleteWithName
                                                                          DeleteOne
                                                                          Search by Name
                                                                          Search by Age
                                                                          Show All
                                                                          Count
                                                                          DatabaseCommand

                                                                          Next Script: [FindDatabase]
                                                                          Script NameFindCollections
                                                                          Run script with full access privilegesOff
                                                                          Include In MenuNo
                                                                          Layouts that use this script
                                                                          Scripts that use this script
                                                                            Script Definition
                                                                            Script Steps
                                                                            • #Gives us a JSON with collection information
                                                                            • Set Variable [ $r; Value:MBS("MongoDB.FindCollections"; $$MongoDB; "{}") ]
                                                                            • If [ MBS("IsError") ]
                                                                            • Show Custom Dialog [ Title: "Error"; Message: $r; Default Button: “OK”, Commit: “Yes” ]
                                                                            • End If
                                                                            • Set Variable [ $Result; Value:"" ]
                                                                            • Loop
                                                                            • Set Variable [ $res; Value:MBS("MongoDB.CursorNext"; $$MongoDB) ]
                                                                            • Exit Loop If [ MBS("IsError") or Length ( $res ) = 0 ]
                                                                            • Set Variable [ $Result; Value:$Result & $res & "¶" ]
                                                                            • End Loop
                                                                            • Set Field [ MongoDB::Result; $Result ]
                                                                            Fields used in this script
                                                                            Scripts used in this script
                                                                              Layouts used in this script
                                                                                Tables used in this script
                                                                                Table occurrences used by this script
                                                                                Custom Functions used by this script
                                                                                  Custom menu set used by this script

                                                                                    Previous Script: [FindCollections]Next Script: [UseCollection]
                                                                                    Script NameFindDatabase
                                                                                    Run script with full access privilegesOff
                                                                                    Include In MenuNo
                                                                                    Layouts that use this script
                                                                                    Scripts that use this script
                                                                                      Script Definition
                                                                                      Script Steps
                                                                                      • #Gives us a JSON with database information
                                                                                      • Set Variable [ $r; Value:MBS( "MongoDB.FindDatabases"; $$MongoDB ) ]
                                                                                      • If [ MBS("IsError") ]
                                                                                      • Show Custom Dialog [ Title: "Error"; Message: $r; Default Button: “OK”, Commit: “Yes” ]
                                                                                      • End If
                                                                                      • Set Variable [ $Result; Value:"" ]
                                                                                      • Loop
                                                                                      • Set Variable [ $res; Value:MBS("MongoDB.CursorNext"; $$MongoDB) ]
                                                                                      • Exit Loop If [ MBS("IsError") or Length ( $res ) = 0 ]
                                                                                      • Set Variable [ $Result; Value:$Result & $res & "¶" ]
                                                                                      • End Loop
                                                                                      • Set Field [ MongoDB::Result; $Result ]
                                                                                      Fields used in this script
                                                                                      Scripts used in this script
                                                                                        Layouts used in this script
                                                                                          Tables used in this script
                                                                                          Table occurrences used by this script
                                                                                          Custom Functions used by this script
                                                                                            Custom menu set used by this script

                                                                                              Previous Script: [FindDatabase]Next Script: [UpdateOne]
                                                                                              Script NameUseCollection
                                                                                              Run script with full access privilegesOff
                                                                                              Include In MenuNo
                                                                                              Layouts that use this script
                                                                                              Scripts that use this script
                                                                                                Script Definition
                                                                                                Script Steps
                                                                                                • #Set the current collection
                                                                                                • Set Variable [ $r; Value:MBS( "MongoDB.OpenCollection"; $$MongoDB; MongoDB::Collection) ]
                                                                                                • If [ MBS("IsError") ]
                                                                                                • Show Custom Dialog [ Title: "Error"; Message: $r; Default Button: “OK”, Commit: “Yes” ]
                                                                                                • End If
                                                                                                Fields used in this script
                                                                                                Scripts used in this script
                                                                                                  Layouts used in this script
                                                                                                    Tables used in this script
                                                                                                    Table occurrences used by this script
                                                                                                    Custom Functions used by this script
                                                                                                      Custom menu set used by this script

                                                                                                        Previous Script: [UseCollection]Next Script: [UpdateMany]
                                                                                                        Script NameUpdateOne
                                                                                                        Run script with full access privilegesOff
                                                                                                        Include In MenuNo
                                                                                                        Layouts that use this script
                                                                                                        Scripts that use this script
                                                                                                          Script Definition
                                                                                                          Script Steps
                                                                                                          • #Update a document. We add the key Age, but we can also can change the Name
                                                                                                          • Set Variable [ $r; Value:MBS( "MongoDB.UpdateOne"; $$MongoDB; "{\"Name\": \""&MongoDB::Name&"\"}"; "{\"$set\": {\"Age\": "&MongoDB::Age&"}}") ]
                                                                                                          • If [ MBS("IsError") ]
                                                                                                          • Show Custom Dialog [ Title: "Error"; Message: $r; Default Button: “OK”, Commit: “Yes” ]
                                                                                                          • Exit Script [ ]
                                                                                                          • End If
                                                                                                          • Perform Script [ “Show All” ]
                                                                                                          Fields used in this script
                                                                                                          Scripts used in this script
                                                                                                          Layouts used in this script
                                                                                                            Tables used in this script
                                                                                                            Table occurrences used by this script
                                                                                                            Custom Functions used by this script
                                                                                                              Custom menu set used by this script

                                                                                                                Previous Script: [UpdateOne]Next Script: [SetCursorLimit]
                                                                                                                Script NameUpdateMany
                                                                                                                Run script with full access privilegesOff
                                                                                                                Include In MenuNo
                                                                                                                Layouts that use this script
                                                                                                                Scripts that use this script
                                                                                                                  Script Definition
                                                                                                                  Script Steps
                                                                                                                  • #We can update not only a single record but several records at the same time that match a criteria we specify in a JSON. If this JSON is an empty object, then all records are referred to. In this case we update documents that have a special name and add an age to it
                                                                                                                  • Set Variable [ $r; Value:MBS( "MongoDB.UpdateMany"; $$MongoDB; "{\"Name\": \""&MongoDB::Name&"\"}"; "{\"$set\": {\"Age\": "&MongoDB::Age&"}}") ]
                                                                                                                  • If [ MBS("IsError") ]
                                                                                                                  • Show Custom Dialog [ Title: "Error"; Message: $r; Default Button: “OK”, Commit: “Yes” ]
                                                                                                                  • Exit Script [ ]
                                                                                                                  • End If
                                                                                                                  • Perform Script [ “Show All” ]
                                                                                                                  Fields used in this script
                                                                                                                  Scripts used in this script
                                                                                                                  Layouts used in this script
                                                                                                                    Tables used in this script
                                                                                                                    Table occurrences used by this script
                                                                                                                    Custom Functions used by this script
                                                                                                                      Custom menu set used by this script

                                                                                                                        Previous Script: [UpdateMany]Next Script: [CurrentCollection]
                                                                                                                        Script NameSetCursorLimit
                                                                                                                        Run script with full access privilegesOff
                                                                                                                        Include In MenuNo
                                                                                                                        Layouts that use this script
                                                                                                                          Scripts that use this script
                                                                                                                          Script Definition
                                                                                                                          Script Steps
                                                                                                                          • #Set the cursor limit. Is called after a find
                                                                                                                          • Set Variable [ $r; Value:MBS( "MongoDB.CursorSetLimit"; $$MongoDB ; MongoDB::CursorLimit ) ]
                                                                                                                          • If [ MBS("IsError") ]
                                                                                                                          • Show Custom Dialog [ Title: "Error"; Message: $r; Default Button: “OK”, Commit: “Yes” ]
                                                                                                                          • End If
                                                                                                                          Fields used in this script
                                                                                                                          Scripts used in this script
                                                                                                                            Layouts used in this script
                                                                                                                              Tables used in this script
                                                                                                                              Table occurrences used by this script
                                                                                                                              Custom Functions used by this script
                                                                                                                                Custom menu set used by this script

                                                                                                                                  Previous Script: [SetCursorLimit]Next Script: [Connection]
                                                                                                                                  Script NameCurrentCollection
                                                                                                                                  Run script with full access privilegesOff
                                                                                                                                  Include In MenuNo
                                                                                                                                  Layouts that use this script
                                                                                                                                  Scripts that use this script
                                                                                                                                    Script Definition
                                                                                                                                    Script Steps
                                                                                                                                    • #Query the current in use collection
                                                                                                                                    • Show Custom Dialog [ Title: "Current Collection"; Message: MBS( "MongoDB.CollectionName"; $$MongoDB ); Default Button: “OK”, Commit: “Yes” ]
                                                                                                                                    Fields used in this script
                                                                                                                                      Scripts used in this script
                                                                                                                                        Layouts used in this script
                                                                                                                                          Tables used in this script
                                                                                                                                            Table occurrences used by this script
                                                                                                                                              Custom Functions used by this script
                                                                                                                                                Custom menu set used by this script

                                                                                                                                                  Previous Script: [CurrentCollection]Next Script: [ListDatabases]
                                                                                                                                                  Script NameConnection
                                                                                                                                                  Run script with full access privilegesOff
                                                                                                                                                  Include In MenuNo
                                                                                                                                                  Layouts that use this script
                                                                                                                                                  Scripts that use this script
                                                                                                                                                    Script Definition
                                                                                                                                                    Script Steps
                                                                                                                                                    • #Connect us to the Server
                                                                                                                                                    • #Old connections are cleaned up
                                                                                                                                                    • If [ $$MongoDB ≠ "" ]
                                                                                                                                                    • Set Variable [ $r; Value: MBS( "MongoDB.Release"; $$MongoDB ) ]
                                                                                                                                                    • // Set Variable [ $r; Value: MBS( "MongoDB.ReleaseAll" ) ]
                                                                                                                                                    • End If
                                                                                                                                                    • #Get a new reference number
                                                                                                                                                    • Set Variable [ $$MongoDB; Value:MBS( "MongoDB.New" ) ]
                                                                                                                                                    • If [ MBS("IsError") ]
                                                                                                                                                    • Show Custom Dialog [ Title: "Error"; Message: $$MongoDB; Default Button: “OK”, Commit: “Yes” ]
                                                                                                                                                    • Exit Script [ ]
                                                                                                                                                    • End If
                                                                                                                                                    • #Set the URI from the field
                                                                                                                                                    • Set Variable [ $r; Value:MBS( "MongoDB.SetURI"; $$MongoDB; MongoDB::URI ) ]
                                                                                                                                                    • If [ MBS("IsError") ]
                                                                                                                                                    • Show Custom Dialog [ Title: "Error"; Message: $r; Default Button: “OK”, Commit: “Yes” ]
                                                                                                                                                    • Exit Script [ ]
                                                                                                                                                    • End If
                                                                                                                                                    • #Connect to the server
                                                                                                                                                    • Set Variable [ $r; Value:MBS( "MongoDB.Connect"; $$MongoDB) ]
                                                                                                                                                    • If [ MBS("IsError") ]
                                                                                                                                                    • Show Custom Dialog [ Title: "Error"; Message: $r; Default Button: “OK”, Commit: “Yes” ]
                                                                                                                                                    • Else
                                                                                                                                                    • Show Custom Dialog [ Title: "Connection"; Message: "OK"; Default Button: “OK”, Commit: “Yes” ]
                                                                                                                                                    • End If
                                                                                                                                                    Fields used in this script
                                                                                                                                                    Scripts used in this script
                                                                                                                                                      Layouts used in this script
                                                                                                                                                        Tables used in this script
                                                                                                                                                        Table occurrences used by this script
                                                                                                                                                        Custom Functions used by this script
                                                                                                                                                          Custom menu set used by this script

                                                                                                                                                            Previous Script: [Connection]Next Script: [UseDatabase]
                                                                                                                                                            Script NameListDatabases
                                                                                                                                                            Run script with full access privilegesOff
                                                                                                                                                            Include In MenuNo
                                                                                                                                                            Layouts that use this script
                                                                                                                                                            Scripts that use this script
                                                                                                                                                              Script Definition
                                                                                                                                                              Script Steps
                                                                                                                                                              • #Gives us a list of databases located on the server
                                                                                                                                                              • Show Custom Dialog [ Title: "List of Databases"; Message: MBS( "MongoDB.DatabasesNames"; $$MongoDB ); Default Button: “OK”, Commit: “Yes” ]
                                                                                                                                                              Fields used in this script
                                                                                                                                                                Scripts used in this script
                                                                                                                                                                  Layouts used in this script
                                                                                                                                                                    Tables used in this script
                                                                                                                                                                      Table occurrences used by this script
                                                                                                                                                                        Custom Functions used by this script
                                                                                                                                                                          Custom menu set used by this script

                                                                                                                                                                            Previous Script: [ListDatabases]Next Script: [Release]
                                                                                                                                                                            Script NameUseDatabase
                                                                                                                                                                            Run script with full access privilegesOff
                                                                                                                                                                            Include In MenuNo
                                                                                                                                                                            Layouts that use this script
                                                                                                                                                                            Scripts that use this script
                                                                                                                                                                              Script Definition
                                                                                                                                                                              Script Steps
                                                                                                                                                                              • #Sets the database as the database we want to use
                                                                                                                                                                              • Set Variable [ $r; Value:MBS( "MongoDB.OpenDatabase"; $$MongoDB; MongoDB::Database ) ]
                                                                                                                                                                              • If [ MBS("IsError") ]
                                                                                                                                                                              • Show Custom Dialog [ Title: "Error"; Message: $r; Default Button: “OK”, Commit: “Yes” ]
                                                                                                                                                                              • End If
                                                                                                                                                                              Fields used in this script
                                                                                                                                                                              Scripts used in this script
                                                                                                                                                                                Layouts used in this script
                                                                                                                                                                                  Tables used in this script
                                                                                                                                                                                  Table occurrences used by this script
                                                                                                                                                                                  Custom Functions used by this script
                                                                                                                                                                                    Custom menu set used by this script

                                                                                                                                                                                      Previous Script: [UseDatabase]Next Script: [LibraryVersion]
                                                                                                                                                                                      Script NameRelease
                                                                                                                                                                                      Run script with full access privilegesOff
                                                                                                                                                                                      Include In MenuNo
                                                                                                                                                                                      Layouts that use this script
                                                                                                                                                                                      Scripts that use this script
                                                                                                                                                                                        Script Definition
                                                                                                                                                                                        Script Steps
                                                                                                                                                                                        • #Release all connections
                                                                                                                                                                                        • Set Variable [ $r; Value: MBS( "MongoDB.ReleaseAll" ) ]
                                                                                                                                                                                        • If [ MBS("IsError") ]
                                                                                                                                                                                        • Show Custom Dialog [ Title: "Error"; Message: $r; Default Button: “OK”, Commit: “Yes” ]
                                                                                                                                                                                        • End If
                                                                                                                                                                                        Fields used in this script
                                                                                                                                                                                          Scripts used in this script
                                                                                                                                                                                            Layouts used in this script
                                                                                                                                                                                              Tables used in this script
                                                                                                                                                                                                Table occurrences used by this script
                                                                                                                                                                                                  Custom Functions used by this script
                                                                                                                                                                                                    Custom menu set used by this script

                                                                                                                                                                                                      Previous Script: [Release]Next Script: [ListCollections]
                                                                                                                                                                                                      Script NameLibraryVersion
                                                                                                                                                                                                      Run script with full access privilegesOff
                                                                                                                                                                                                      Include In MenuNo
                                                                                                                                                                                                      Layouts that use this script
                                                                                                                                                                                                      Scripts that use this script
                                                                                                                                                                                                        Script Definition
                                                                                                                                                                                                        Script Steps
                                                                                                                                                                                                        • #Query the library version
                                                                                                                                                                                                        • Show Custom Dialog [ Title: "Library Version"; Message: MBS( "MongoDB.LibraryVersion" ); Default Button: “OK”, Commit: “Yes” ]
                                                                                                                                                                                                        Fields used in this script
                                                                                                                                                                                                          Scripts used in this script
                                                                                                                                                                                                            Layouts used in this script
                                                                                                                                                                                                              Tables used in this script
                                                                                                                                                                                                                Table occurrences used by this script
                                                                                                                                                                                                                  Custom Functions used by this script
                                                                                                                                                                                                                    Custom menu set used by this script

                                                                                                                                                                                                                      Previous Script: [LibraryVersion]Next Script: [Replace]
                                                                                                                                                                                                                      Script NameListCollections
                                                                                                                                                                                                                      Run script with full access privilegesOff
                                                                                                                                                                                                                      Include In MenuNo
                                                                                                                                                                                                                      Layouts that use this script
                                                                                                                                                                                                                      Scripts that use this script
                                                                                                                                                                                                                        Script Definition
                                                                                                                                                                                                                        Script Steps
                                                                                                                                                                                                                        • #Gives us a list of collections located in the current database
                                                                                                                                                                                                                        • Show Custom Dialog [ Title: "List of Collections"; Message: MBS( "MongoDB.CollectionNames";$$MongoDB ); Default Button: “OK”, Commit: “Yes”; Button 2: “Abbrechen”, Commit: “No” ]
                                                                                                                                                                                                                        Fields used in this script
                                                                                                                                                                                                                          Scripts used in this script
                                                                                                                                                                                                                            Layouts used in this script
                                                                                                                                                                                                                              Tables used in this script
                                                                                                                                                                                                                                Table occurrences used by this script
                                                                                                                                                                                                                                  Custom Functions used by this script
                                                                                                                                                                                                                                    Custom menu set used by this script

                                                                                                                                                                                                                                      Previous Script: [ListCollections]Next Script: [UseDefaultDatabase]
                                                                                                                                                                                                                                      Script NameReplace
                                                                                                                                                                                                                                      Run script with full access privilegesOff
                                                                                                                                                                                                                                      Include In MenuNo
                                                                                                                                                                                                                                      Layouts that use this script
                                                                                                                                                                                                                                      Scripts that use this script
                                                                                                                                                                                                                                        Script Definition
                                                                                                                                                                                                                                        Script Steps
                                                                                                                                                                                                                                        • #Replaces a document with a document that can have completely different fields
                                                                                                                                                                                                                                        • Set Variable [ $r; Value:MBS( "MongoDB.ReplaceOne"; $$MongoDB; "{\"Name\":\""& MongoDB::Name &"\"}"; "{\"Typ\": \"clothes\", \"ArtNum\": 1234, \"InStock\": true, \"Age\": 3}") ]
                                                                                                                                                                                                                                        • If [ MBS("IsError") ]
                                                                                                                                                                                                                                        • Show Custom Dialog [ Title: "Error"; Message: $r; Default Button: “OK”, Commit: “Yes” ]
                                                                                                                                                                                                                                        • End If
                                                                                                                                                                                                                                        • Perform Script [ “Show All” ]
                                                                                                                                                                                                                                        Fields used in this script
                                                                                                                                                                                                                                        Scripts used in this script
                                                                                                                                                                                                                                        Layouts used in this script
                                                                                                                                                                                                                                          Tables used in this script
                                                                                                                                                                                                                                          Table occurrences used by this script
                                                                                                                                                                                                                                          Custom Functions used by this script
                                                                                                                                                                                                                                            Custom menu set used by this script

                                                                                                                                                                                                                                              Previous Script: [Replace]Next Script: [Insert One]
                                                                                                                                                                                                                                              Script NameUseDefaultDatabase
                                                                                                                                                                                                                                              Run script with full access privilegesOff
                                                                                                                                                                                                                                              Include In MenuNo
                                                                                                                                                                                                                                              Layouts that use this script
                                                                                                                                                                                                                                              Scripts that use this script
                                                                                                                                                                                                                                                Script Definition
                                                                                                                                                                                                                                                Script Steps
                                                                                                                                                                                                                                                • #Set the default database the current database
                                                                                                                                                                                                                                                • Set Variable [ $r; Value:MBS( "MongoDB.OpenDefaultDatabase"; $$MongoDB) ]
                                                                                                                                                                                                                                                • If [ MBS("IsError") ]
                                                                                                                                                                                                                                                • Show Custom Dialog [ Title: "Error"; Message: $r; Default Button: “OK”, Commit: “Yes” ]
                                                                                                                                                                                                                                                • End If
                                                                                                                                                                                                                                                Fields used in this script
                                                                                                                                                                                                                                                  Scripts used in this script
                                                                                                                                                                                                                                                    Layouts used in this script
                                                                                                                                                                                                                                                      Tables used in this script
                                                                                                                                                                                                                                                        Table occurrences used by this script
                                                                                                                                                                                                                                                          Custom Functions used by this script
                                                                                                                                                                                                                                                            Custom menu set used by this script

                                                                                                                                                                                                                                                              Previous Script: [UseDefaultDatabase]Next Script: [DeleteAll]
                                                                                                                                                                                                                                                              Script NameInsert One
                                                                                                                                                                                                                                                              Run script with full access privilegesOff
                                                                                                                                                                                                                                                              Include In MenuNo
                                                                                                                                                                                                                                                              Layouts that use this script
                                                                                                                                                                                                                                                              Scripts that use this script
                                                                                                                                                                                                                                                                Script Definition
                                                                                                                                                                                                                                                                Script Steps
                                                                                                                                                                                                                                                                • #We add a single document with the specified name to the collection
                                                                                                                                                                                                                                                                • Set Variable [ $r; Value:MBS( "MongoDB.InsertOne"; $$MongoDB; " { \"Name\": \""&MongoDB::Name&"\"}" ) ]
                                                                                                                                                                                                                                                                • If [ MBS("IsError") ]
                                                                                                                                                                                                                                                                • Show Custom Dialog [ Title: "Error"; Message: $r; Default Button: “OK”, Commit: “Yes” ]
                                                                                                                                                                                                                                                                • Exit Script [ ]
                                                                                                                                                                                                                                                                • End If
                                                                                                                                                                                                                                                                • Perform Script [ “Show All” ]
                                                                                                                                                                                                                                                                Fields used in this script
                                                                                                                                                                                                                                                                Scripts used in this script
                                                                                                                                                                                                                                                                Layouts used in this script
                                                                                                                                                                                                                                                                  Tables used in this script
                                                                                                                                                                                                                                                                  Table occurrences used by this script
                                                                                                                                                                                                                                                                  Custom Functions used by this script
                                                                                                                                                                                                                                                                    Custom menu set used by this script

                                                                                                                                                                                                                                                                      Previous Script: [Insert One]Next Script: [DeleteWithName]
                                                                                                                                                                                                                                                                      Script NameDeleteAll
                                                                                                                                                                                                                                                                      Run script with full access privilegesOff
                                                                                                                                                                                                                                                                      Include In MenuNo
                                                                                                                                                                                                                                                                      Layouts that use this script
                                                                                                                                                                                                                                                                      Scripts that use this script
                                                                                                                                                                                                                                                                        Script Definition
                                                                                                                                                                                                                                                                        Script Steps
                                                                                                                                                                                                                                                                        • #Delete all documents in the collection
                                                                                                                                                                                                                                                                        • Set Variable [ $r; Value:MBS( "MongoDB.DeleteMany"; $$MongoDB; "{}" ) ]
                                                                                                                                                                                                                                                                        • Perform Script [ “Show All” ]
                                                                                                                                                                                                                                                                        Fields used in this script
                                                                                                                                                                                                                                                                          Scripts used in this script
                                                                                                                                                                                                                                                                          Layouts used in this script
                                                                                                                                                                                                                                                                            Tables used in this script
                                                                                                                                                                                                                                                                              Table occurrences used by this script
                                                                                                                                                                                                                                                                                Custom Functions used by this script
                                                                                                                                                                                                                                                                                  Custom menu set used by this script

                                                                                                                                                                                                                                                                                    Previous Script: [DeleteAll]Next Script: [DeleteOne]
                                                                                                                                                                                                                                                                                    Script NameDeleteWithName
                                                                                                                                                                                                                                                                                    Run script with full access privilegesOff
                                                                                                                                                                                                                                                                                    Include In MenuNo
                                                                                                                                                                                                                                                                                    Layouts that use this script
                                                                                                                                                                                                                                                                                    Scripts that use this script
                                                                                                                                                                                                                                                                                      Script Definition
                                                                                                                                                                                                                                                                                      Script Steps
                                                                                                                                                                                                                                                                                      • #Delete all documents with a given Name
                                                                                                                                                                                                                                                                                      • Set Variable [ $r; Value:MBS( "MongoDB.DeleteMany"; $$MongoDB; "{\"Name\": \""& MongoDB::Name &"\" }" ) ]
                                                                                                                                                                                                                                                                                      • Perform Script [ “Show All” ]
                                                                                                                                                                                                                                                                                      Fields used in this script
                                                                                                                                                                                                                                                                                      Scripts used in this script
                                                                                                                                                                                                                                                                                      Layouts used in this script
                                                                                                                                                                                                                                                                                        Tables used in this script
                                                                                                                                                                                                                                                                                        Table occurrences used by this script
                                                                                                                                                                                                                                                                                        Custom Functions used by this script
                                                                                                                                                                                                                                                                                          Custom menu set used by this script

                                                                                                                                                                                                                                                                                            Previous Script: [DeleteWithName]Next Script: [Search by Name]
                                                                                                                                                                                                                                                                                            Script NameDeleteOne
                                                                                                                                                                                                                                                                                            Run script with full access privilegesOff
                                                                                                                                                                                                                                                                                            Include In MenuNo
                                                                                                                                                                                                                                                                                            Layouts that use this script
                                                                                                                                                                                                                                                                                            Scripts that use this script
                                                                                                                                                                                                                                                                                              Script Definition
                                                                                                                                                                                                                                                                                              Script Steps
                                                                                                                                                                                                                                                                                              • #Delete the first document
                                                                                                                                                                                                                                                                                              • Set Variable [ $r; Value:MBS( "MongoDB.DeleteOne"; $$MongoDB; "{}" ) ]
                                                                                                                                                                                                                                                                                              • Perform Script [ “Show All” ]
                                                                                                                                                                                                                                                                                              Fields used in this script
                                                                                                                                                                                                                                                                                                Scripts used in this script
                                                                                                                                                                                                                                                                                                Layouts used in this script
                                                                                                                                                                                                                                                                                                  Tables used in this script
                                                                                                                                                                                                                                                                                                    Table occurrences used by this script
                                                                                                                                                                                                                                                                                                      Custom Functions used by this script
                                                                                                                                                                                                                                                                                                        Custom menu set used by this script

                                                                                                                                                                                                                                                                                                          Previous Script: [DeleteOne]Next Script: [Search by Age]
                                                                                                                                                                                                                                                                                                          Script NameSearch by Name
                                                                                                                                                                                                                                                                                                          Run script with full access privilegesOff
                                                                                                                                                                                                                                                                                                          Include In MenuNo
                                                                                                                                                                                                                                                                                                          Layouts that use this script
                                                                                                                                                                                                                                                                                                          Scripts that use this script
                                                                                                                                                                                                                                                                                                            Script Definition
                                                                                                                                                                                                                                                                                                            Script Steps
                                                                                                                                                                                                                                                                                                            • #Find all documents with a given name
                                                                                                                                                                                                                                                                                                            • Set Variable [ $r; Value:MBS("MongoDB.Find"; $$MongoDB;"{\"Name\":\"" & MongoDB::Name & "\"}") ]
                                                                                                                                                                                                                                                                                                            • If [ MBS("IsError") ]
                                                                                                                                                                                                                                                                                                            • Show Custom Dialog [ Title: "Error"; Message: $r; Default Button: “OK”, Commit: “Yes” ]
                                                                                                                                                                                                                                                                                                            • End If
                                                                                                                                                                                                                                                                                                            • #Set Limit if it was set
                                                                                                                                                                                                                                                                                                            • If [ $$Limit>0 ]
                                                                                                                                                                                                                                                                                                            • Perform Script [ “SetCursorLimit” ]
                                                                                                                                                                                                                                                                                                            • End If
                                                                                                                                                                                                                                                                                                            • #Runs the cursor over the find
                                                                                                                                                                                                                                                                                                            • Set Variable [ $Result; Value:"" ]
                                                                                                                                                                                                                                                                                                            • Loop
                                                                                                                                                                                                                                                                                                            • Set Variable [ $res; Value:MBS("MongoDB.CursorNext"; $$MongoDB) ]
                                                                                                                                                                                                                                                                                                            • Exit Loop If [ MBS("IsError") or Length ( $res ) = 0 ]
                                                                                                                                                                                                                                                                                                            • Set Variable [ $Result; Value:$Result & $res & "¶" ]
                                                                                                                                                                                                                                                                                                            • End Loop
                                                                                                                                                                                                                                                                                                            • Set Field [ MongoDB::Result; $Result ]
                                                                                                                                                                                                                                                                                                            Fields used in this script
                                                                                                                                                                                                                                                                                                            Scripts used in this script
                                                                                                                                                                                                                                                                                                            Layouts used in this script
                                                                                                                                                                                                                                                                                                              Tables used in this script
                                                                                                                                                                                                                                                                                                              Table occurrences used by this script
                                                                                                                                                                                                                                                                                                              Custom Functions used by this script
                                                                                                                                                                                                                                                                                                                Custom menu set used by this script

                                                                                                                                                                                                                                                                                                                  Previous Script: [Search by Name]Next Script: [Show All]
                                                                                                                                                                                                                                                                                                                  Script NameSearch by Age
                                                                                                                                                                                                                                                                                                                  Run script with full access privilegesOff
                                                                                                                                                                                                                                                                                                                  Include In MenuNo
                                                                                                                                                                                                                                                                                                                  Layouts that use this script
                                                                                                                                                                                                                                                                                                                  Scripts that use this script
                                                                                                                                                                                                                                                                                                                    Script Definition
                                                                                                                                                                                                                                                                                                                    Script Steps
                                                                                                                                                                                                                                                                                                                    • #Find all documents with an age < 20
                                                                                                                                                                                                                                                                                                                    • Set Variable [ $r; Value:MBS("MongoDB.Find"; $$MongoDB;"{\"Age\": {\"$lt\": 20}}") ]
                                                                                                                                                                                                                                                                                                                    • If [ MBS("IsError") ]
                                                                                                                                                                                                                                                                                                                    • Show Custom Dialog [ Title: "Error"; Message: $r; Default Button: “OK”, Commit: “Yes” ]
                                                                                                                                                                                                                                                                                                                    • End If
                                                                                                                                                                                                                                                                                                                    • #Set Limit if it was set
                                                                                                                                                                                                                                                                                                                    • If [ $$Limit>0 ]
                                                                                                                                                                                                                                                                                                                    • Perform Script [ “SetCursorLimit” ]
                                                                                                                                                                                                                                                                                                                    • End If
                                                                                                                                                                                                                                                                                                                    • #Runs the cursor over the find
                                                                                                                                                                                                                                                                                                                    • Set Variable [ $Result; Value:"" ]
                                                                                                                                                                                                                                                                                                                    • Loop
                                                                                                                                                                                                                                                                                                                    • Set Variable [ $res; Value:MBS("MongoDB.CursorNext"; $$MongoDB) ]
                                                                                                                                                                                                                                                                                                                    • Exit Loop If [ MBS("IsError") or Length ( $res ) = 0 ]
                                                                                                                                                                                                                                                                                                                    • Set Variable [ $Result; Value:$Result & $res & "¶" ]
                                                                                                                                                                                                                                                                                                                    • End Loop
                                                                                                                                                                                                                                                                                                                    • Set Field [ MongoDB::Result; $Result ]
                                                                                                                                                                                                                                                                                                                    Fields used in this script
                                                                                                                                                                                                                                                                                                                    Scripts used in this script
                                                                                                                                                                                                                                                                                                                    Layouts used in this script
                                                                                                                                                                                                                                                                                                                      Tables used in this script
                                                                                                                                                                                                                                                                                                                      Table occurrences used by this script
                                                                                                                                                                                                                                                                                                                      Custom Functions used by this script
                                                                                                                                                                                                                                                                                                                        Custom menu set used by this script

                                                                                                                                                                                                                                                                                                                          Previous Script: [Search by Age]Next Script: [Count]
                                                                                                                                                                                                                                                                                                                          Script NameShow All
                                                                                                                                                                                                                                                                                                                          Run script with full access privilegesOff
                                                                                                                                                                                                                                                                                                                          Include In MenuNo
                                                                                                                                                                                                                                                                                                                          Layouts that use this script
                                                                                                                                                                                                                                                                                                                          Scripts that use this script
                                                                                                                                                                                                                                                                                                                          Script Definition
                                                                                                                                                                                                                                                                                                                          Script Steps
                                                                                                                                                                                                                                                                                                                          • #With the find function and an empty JSON we get all documents
                                                                                                                                                                                                                                                                                                                          • Set Variable [ $r; Value:MBS("MongoDB.Find"; $$MongoDB;"{}") ]
                                                                                                                                                                                                                                                                                                                          • #Set Limit if it was set
                                                                                                                                                                                                                                                                                                                          • If [ $$Limit>0 ]
                                                                                                                                                                                                                                                                                                                          • Perform Script [ “SetCursorLimit” ]
                                                                                                                                                                                                                                                                                                                          • End If
                                                                                                                                                                                                                                                                                                                          • If [ MBS("IsError") ]
                                                                                                                                                                                                                                                                                                                          • Show Custom Dialog [ Title: "Error"; Message: $r; Default Button: “OK”, Commit: “Yes” ]
                                                                                                                                                                                                                                                                                                                          • End If
                                                                                                                                                                                                                                                                                                                          • #Runs the cursor over the find
                                                                                                                                                                                                                                                                                                                          • Set Variable [ $Result; Value:"" ]
                                                                                                                                                                                                                                                                                                                          • Loop
                                                                                                                                                                                                                                                                                                                          • Set Variable [ $res; Value:MBS("MongoDB.CursorNext"; $$MongoDB) ]
                                                                                                                                                                                                                                                                                                                          • Exit Loop If [ MBS("IsError") or Length ( $res ) = 0 ]
                                                                                                                                                                                                                                                                                                                          • Set Variable [ $Result; Value:$Result & $res & "¶" ]
                                                                                                                                                                                                                                                                                                                          • End Loop
                                                                                                                                                                                                                                                                                                                          • Set Field [ MongoDB::Result; $Result ]
                                                                                                                                                                                                                                                                                                                          Fields used in this script
                                                                                                                                                                                                                                                                                                                          Scripts used in this script
                                                                                                                                                                                                                                                                                                                          Layouts used in this script
                                                                                                                                                                                                                                                                                                                            Tables used in this script
                                                                                                                                                                                                                                                                                                                            Table occurrences used by this script
                                                                                                                                                                                                                                                                                                                            Custom Functions used by this script
                                                                                                                                                                                                                                                                                                                              Custom menu set used by this script

                                                                                                                                                                                                                                                                                                                                Previous Script: [Show All]Next Script: [DatabaseCommand]
                                                                                                                                                                                                                                                                                                                                Script NameCount
                                                                                                                                                                                                                                                                                                                                Run script with full access privilegesOff
                                                                                                                                                                                                                                                                                                                                Include In MenuNo
                                                                                                                                                                                                                                                                                                                                Layouts that use this script
                                                                                                                                                                                                                                                                                                                                Scripts that use this script
                                                                                                                                                                                                                                                                                                                                  Script Definition
                                                                                                                                                                                                                                                                                                                                  Script Steps
                                                                                                                                                                                                                                                                                                                                  • #Count the documents in the current collection
                                                                                                                                                                                                                                                                                                                                  • Show Custom Dialog [ Title: "Count"; Message: MBS( "MongoDB.EstimatedDocumentCount"; $$MongoDB ); Default Button: “OK”, Commit: “Yes” ]
                                                                                                                                                                                                                                                                                                                                  Fields used in this script
                                                                                                                                                                                                                                                                                                                                    Scripts used in this script
                                                                                                                                                                                                                                                                                                                                      Layouts used in this script
                                                                                                                                                                                                                                                                                                                                        Tables used in this script
                                                                                                                                                                                                                                                                                                                                          Table occurrences used by this script
                                                                                                                                                                                                                                                                                                                                            Custom Functions used by this script
                                                                                                                                                                                                                                                                                                                                              Custom menu set used by this script

                                                                                                                                                                                                                                                                                                                                                Previous Script: [Count]
                                                                                                                                                                                                                                                                                                                                                Script NameDatabaseCommand
                                                                                                                                                                                                                                                                                                                                                Run script with full access privilegesOff
                                                                                                                                                                                                                                                                                                                                                Include In MenuNo
                                                                                                                                                                                                                                                                                                                                                Layouts that use this script
                                                                                                                                                                                                                                                                                                                                                Scripts that use this script
                                                                                                                                                                                                                                                                                                                                                  Script Definition
                                                                                                                                                                                                                                                                                                                                                  Script Steps
                                                                                                                                                                                                                                                                                                                                                  • #With this function you can use database commands
                                                                                                                                                                                                                                                                                                                                                  • Set Variable [ $res; Value:MBS( "MongoDB.DatabaseCommand"; $$MongoDB; MongoDB::Command ) ]
                                                                                                                                                                                                                                                                                                                                                  • If [ MBS("IsError") ]
                                                                                                                                                                                                                                                                                                                                                  • Show Custom Dialog [ Title: "Error"; Message: $res; Default Button: “OK”, Commit: “Yes” ]
                                                                                                                                                                                                                                                                                                                                                  • Else
                                                                                                                                                                                                                                                                                                                                                  • Set Field [ MongoDB::Result; $res ]
                                                                                                                                                                                                                                                                                                                                                  • End If
                                                                                                                                                                                                                                                                                                                                                  Fields used in this script
                                                                                                                                                                                                                                                                                                                                                  Scripts used in this script
                                                                                                                                                                                                                                                                                                                                                    Layouts used in this script
                                                                                                                                                                                                                                                                                                                                                      Tables used in this script
                                                                                                                                                                                                                                                                                                                                                      Table occurrences used by this script
                                                                                                                                                                                                                                                                                                                                                      Custom Functions used by this script
                                                                                                                                                                                                                                                                                                                                                        Custom menu set used by this script

                                                                                                                                                                                                                                                                                                                                                          Download example: MongoDB Blog

                                                                                                                                                                                                                                                                                                                                                          Used functions: