カスタムスキーマ例
このセクションでは、GenerateSchemaFiles によって自動生成された完全なスキーマの例を示します。Location プロパティをスキーマファイルを格納するファイルディレクトリに設定します。スキーマは、以下で構成されています。
- info セクションではMongoDB オブジェクトのリレーショナルビューを可能にします。詳細はカスタムスキーマ定義 を参照してください。
- collection アトリビュートは、パースするコレクションの名前を指定します。collection アトリビュートは、同じコレクションに対して複数のスキーマを定義するために使用できます。collection が指定されていない場合は、filename がパースされるコレクションを決定します。
- GET、POST、MERGE、およびDELETE メソッドは、このテーブルに対してSELECT、INSERT、UPDATE、およびDELETE コマンドを許容します。coreExecOperation 処理は内部実装であり、そのまま独自のカスタムスキーマファイルにコピーできます。
<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>