Skip to main content

MongoDB Specifics

Hint

This article is generated by AI translation.

dbVisitor accesses MongoDB via the JDBC-Mongo driver over JDBC. Note:

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.