code: def get_planned_migrations(self) -> list[Migration]:
      saved_migrations_versions = sorted(
          self.get_saved_migrations_versions()
      )
      collected_migrations = sorted(
          self.collected_migrations, key=lambda m: m.version
      )
      first_collected_migrations_versions = [
          migration.version
          for migration in collected_migrations[
              : len(saved_migrations_versions)
          ]
      ]
      if (
          saved_migrations_versions
          != first_collected_migrations_versions
      ):
          logging.error(
              "Database migrations are not in sync with collected migrations. Database:"
              f" {saved_migrations_versions}, Collected: {first_collected_migrations_versions}"
          )
          raise SavedMigrationsError(
              "The saved migrations in the database should be the first collected migrations."
          )
      num_saved_migrations = len(saved_migrations_versions)
      num_collected_migrations = len(collected_migrations)
      if not num_collected_migrations:
          logging.error("No collected migrations")
      if num_saved_migrations:
          logging.info(
              f"{num_saved_migrations} migrations have already been applied. They will be skipped."
          )
      if num_saved_migrations == len(collected_migrations):
          logging.info("All migrations have already been applied.")
      return collected_migrations[num_saved_migrations:]
  
file_path: datasets-server/jobs/mongodb_migration/src/mongodb_migration/plan.py
imports: import logging
  from mongodb_migration.database_migrations import DatabaseMigration
  from mongodb_migration.migration import Migration
label_desc: Use image node_id 3 for calling the Plan obj's underlying member method code with example usage: obj.get_planned_migrations() and returns: collected_migrations