Docs Menu

Before running SQL queries on your dataset, you must register a temporary view for the dataset.

The following operation registers a characters table and then queries it to find all characters that are 100 or older:

val characters ="mongodb").as[Character]
val centenarians = spark.sql("SELECT name, age FROM characters WHERE age >= 100")
MongoDB Connector for Spark →
Give Feedback
© 2022 MongoDB, Inc.


  • Careers
  • Investor Relations
  • Legal Notices
  • Privacy Notices
  • Security Information
  • Trust Center
© 2022 MongoDB, Inc.