JDBC Driver for MongoDB

Build 22.0.8462

Custom Schema Example

This section contains an example of a complete schema that has been automatically generated by GenerateSchemaFiles. Set the Location property to the file directory that will contain the schema file. The schema consists of the following parts:

  • The info section enables a relational view of a MongoDB object. For more details, see Custom Schema Definitions.

  • The collection attribute specifies the name of the collection to be parsed. The collection attribute can be used to define multiple schemas for the same collection. If collection is not specified, the filename determines the collection that is parsed.

  • The GET, POST, MERGE, and DELETE methods allow SELECT, INSERT, UPDATE, and DELETE commands to this table. The coreExecOperation operation is an internal implementation and can be copied as-is to your own custom schema file.

<rsb:script xmlns:rsb="http://www.rssbus.com/ns/rsbscript/2">  

  <rsb:info title="StaticRestaurants" description="Automatic GenerateSchemaFile">  
    <!-- Column definitions -->
    <attr  name="borough"           xs:type="string"  other:bsonpath="$.borough"          />
    <attr  name="cuisine"           xs:type="string"  other:bsonpath="$.cuisine"          />
    <attr  name="address_building"  xs:type="string"  other:bsonpath="$.address.building" />
    <attr  name="address_street"    xs:type="string"  other:bsonpath="$.address.street"   />
    <attr  name="address_coord_0"   xs:type="double"  other:bsonpath="$.address.coord.0"  />
    <attr  name="address_coord_1"   xs:type="double"  other:bsonpath="$.address.coord.1"  />
  </rsb:info>  

  <rsb:set attr="collection" value="restaurants"/>

  <rsb:script method="GET">
    <rsb:call op="coreExecOperation" out="toout">
      <rsb:push item="toout"/>
    </rsb:call>
  </rsb:script>

  <rsb:script method="POST">
    <rsb:call op="coreExecOperation" out="toout">
      <rsb:push item="toout"/>
    </rsb:call>
  </rsb:script>

  <rsb:script method="DELETE">
    <rsb:call op="coreExecOperation" out="toout">
      <rsb:push item="toout"/>
    </rsb:call>
  </rsb:script>

  <rsb:script method="MERGE">
    <rsb:call op="coreExecOperation" out="toout">
      <rsb:push item="toout"/>
    </rsb:call>
  </rsb:script>

</rsb:script>

Copyright (c) 2023 CData Software, Inc. - All rights reserved.
Build 22.0.8462