MongoDB Specifics
Hint
This article is generated by AI translation.
dbVisitor accesses MongoDB via the JDBC-Mongo driver over JDBC. Note:
- Use MongoDB commands; see supported commands.
- Supports JdbcTemplate, method annotations, and Mapper File.
- Supports rules and argument passing for complex command building.
- Supports ResultSetExtractor, RowMapper for consuming results.
- Supports Dynamic Command tags in mapper files.
- Supports Fluent API and BaseMapper.
- Supports ObjectMapping and ResultMapping.
- Does not support JdbcTemplate
executeBatch. - Does not support JdbcTemplate stored procedure APIs.
Analogy
MongoDB commands return one of three shapes: UpdateCount, Single Result, or ResultSet.
- Update count: similar to relational INSERT/UPDATE/DELETE; call
executeUpdate. - Single/multi row: similar to SELECT queries; all read commands (and commands that cannot report via update count) return result sets.
- Result sets expose
_ID(first column) and_JSON(second column), both as strings.
Guide
Execute commands
- JSONB Query: run raw MongoDB commands via JdbcTemplate.
- Fluent API: type-safe MongoDB operations with LambdaTemplate.
- BaseMapper: simplify CRUD with BaseMapper.
- Annotations: use @Insert/@Update/@Delete on mapper interfaces for customized CRUD.
- Mapper File: configure commands via XML tags.