diff --git a/mflix/client/package.json b/mflix/client/package.json index 3cc711d..0faeda2 100644 --- a/mflix/client/package.json +++ b/mflix/client/package.json @@ -1,5 +1,8 @@ { "name": "sample-mflix-front-end", + "description": "Next.js frontend for MongoDB sample mflix application demonstrating CRUD operations, aggregations, and search", + "license": "Apache-2.0", + "author": "MongoDB Documentation Team", "version": "0.1.0", "private": true, "scripts": { diff --git a/mflix/server/java-spring/src/main/java/com/mongodb/samplemflix/controller/MovieControllerImpl.java b/mflix/server/java-spring/src/main/java/com/mongodb/samplemflix/controller/MovieControllerImpl.java index 5a9c638..5ca9ceb 100644 --- a/mflix/server/java-spring/src/main/java/com/mongodb/samplemflix/controller/MovieControllerImpl.java +++ b/mflix/server/java-spring/src/main/java/com/mongodb/samplemflix/controller/MovieControllerImpl.java @@ -40,9 +40,9 @@ * - DELETE /api/movies/{id} - Delete a movie * - DELETE /api/movies - Delete multiple movies * - DELETE /api/movies/{id}/find-and-delete - Find and delete a movie - * - GET /api/movies/aggregations/comments - Aggregate movies with most comments - * - GET /api/movies/aggregations/years - Aggregate movies by year with statistics - * - GET /api/movies/aggregations/directors - Aggregate directors with most movies + * - GET /api/movies/aggregations/reportingByComments - Aggregate movies with most comments + * - GET /api/movies/aggregations/reportingByYear - Aggregate movies by year with statistics + * - GET /api/movies/aggregations/reportingByDirectors - Aggregate directors with most movies * - GET /api/movies/search - Text search using MongoDB Search Index across multiple fields (plot, fullplot, directors, writers, cast) * - GET /api/movies/vector-search - Vector search using Voyage AI embeddings to find movies with similar plots * - GET /api/movies/find-similar-movies - Vector search to find similar movies based on plot embeddings @@ -296,7 +296,7 @@ public ResponseEntity> deleteMoviesBatch( description = "Aggregates movies with their most recent comments using MongoDB $lookup (join) operation. " + "Demonstrates how to combine data from the movies and comments collections." ) - @GetMapping("/aggregations/comments") + @GetMapping("/aggregations/reportingByComments") public ResponseEntity>> getMoviesWithMostRecentComments( @Parameter(description = "Maximum number of movies to return (default: 10, max: 50)") @RequestParam(defaultValue = "10") Integer limit, @@ -331,7 +331,7 @@ public ResponseEntity>> getMoviesW description = "Aggregates movies by year with statistics including movie count and average rating. " + "Demonstrates MongoDB $group operation for statistical aggregation." ) - @GetMapping("/aggregations/years") + @GetMapping("/aggregations/reportingByYear") public ResponseEntity>> getMoviesByYearWithStats() { List results = movieService.getMoviesByYearWithStats(); @@ -352,7 +352,7 @@ public ResponseEntity>> getMoviesByYear description = "Aggregates directors with the most movies and their statistics. " + "Demonstrates MongoDB $unwind operation for array flattening and aggregation." ) - @GetMapping("/aggregations/directors") + @GetMapping("/aggregations/reportingByDirectors") public ResponseEntity>> getDirectorsWithMostMovies( @Parameter(description = "Maximum number of directors to return (default: 20, max: 100)") @RequestParam(defaultValue = "20") Integer limit) { diff --git a/mflix/server/java-spring/src/main/java/com/mongodb/samplemflix/exception/DatabaseOperationException.java b/mflix/server/java-spring/src/main/java/com/mongodb/samplemflix/exception/DatabaseOperationException.java index 44cfd52..315939f 100644 --- a/mflix/server/java-spring/src/main/java/com/mongodb/samplemflix/exception/DatabaseOperationException.java +++ b/mflix/server/java-spring/src/main/java/com/mongodb/samplemflix/exception/DatabaseOperationException.java @@ -12,9 +12,5 @@ public class DatabaseOperationException extends RuntimeException { public DatabaseOperationException(String message) { super(message); } - - public DatabaseOperationException(String message, Throwable cause) { - super(message, cause); - } } diff --git a/mflix/server/java-spring/src/main/java/com/mongodb/samplemflix/exception/ResourceNotFoundException.java b/mflix/server/java-spring/src/main/java/com/mongodb/samplemflix/exception/ResourceNotFoundException.java index ac2c81c..2322903 100644 --- a/mflix/server/java-spring/src/main/java/com/mongodb/samplemflix/exception/ResourceNotFoundException.java +++ b/mflix/server/java-spring/src/main/java/com/mongodb/samplemflix/exception/ResourceNotFoundException.java @@ -4,17 +4,12 @@ * Exception thrown when a requested resource is not found. * * This exception results in a 404 Not Found response. - * - * TODO: Phase 7 - Implement custom exception + * */ public class ResourceNotFoundException extends RuntimeException { public ResourceNotFoundException(String message) { super(message); } - - public ResourceNotFoundException(String message, Throwable cause) { - super(message, cause); - } } diff --git a/mflix/server/java-spring/src/main/java/com/mongodb/samplemflix/exception/ValidationException.java b/mflix/server/java-spring/src/main/java/com/mongodb/samplemflix/exception/ValidationException.java index 84175df..fa9fec5 100644 --- a/mflix/server/java-spring/src/main/java/com/mongodb/samplemflix/exception/ValidationException.java +++ b/mflix/server/java-spring/src/main/java/com/mongodb/samplemflix/exception/ValidationException.java @@ -4,17 +4,12 @@ * Exception thrown when request validation fails. * * This exception results in a 400 Bad Request response. - * - * TODO: Phase 7 - Implement custom exception + * */ public class ValidationException extends RuntimeException { public ValidationException(String message) { super(message); } - - public ValidationException(String message, Throwable cause) { - super(message, cause); - } } diff --git a/mflix/server/java-spring/src/main/java/com/mongodb/samplemflix/model/Comment.java b/mflix/server/java-spring/src/main/java/com/mongodb/samplemflix/model/Comment.java deleted file mode 100644 index 15d9c94..0000000 --- a/mflix/server/java-spring/src/main/java/com/mongodb/samplemflix/model/Comment.java +++ /dev/null @@ -1,69 +0,0 @@ -package com.mongodb.samplemflix.model; - -import java.util.Date; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; -import org.bson.types.ObjectId; -import org.springframework.data.annotation.Id; -import org.springframework.data.mongodb.core.mapping.Document; -import org.springframework.data.mongodb.core.mapping.Field; - -/** - * Domain model representing a comment document from the MongoDB comments collection. - * - *

This class maps to the comments collection in the sample_mflix database. - * Comments are user reviews/comments associated with movies. - * - *

TODO: Implement Comment functionality: - * - Create CommentRepository extending MongoRepository - * - Create CommentService and CommentServiceImpl - * - Create CommentController with REST endpoints - * - Add validation annotations (@NotNull, @Email, etc.) - * - Add unit tests for Comment service and controller - * - Add integration tests - * - Implement query methods (findByMovieId, findByEmail, etc.) - */ -@Data -@Builder -@NoArgsConstructor -@AllArgsConstructor -@Document(collection = "comments") -public class Comment { - - /** - * MongoDB document ID. - * Maps to the _id field in MongoDB. - */ - @Id - private ObjectId id; - - /** - * Name of the commenter. - */ - private String name; - - /** - * Email address of the commenter. - */ - private String email; - - /** - * ID of the movie this comment is associated with. - * References a document in the movies collection. - */ - @Field("movie_id") - private ObjectId movieId; - - /** - * Comment text content. - */ - private String text; - - /** - * Date when the comment was posted. - */ - private Date date; - -} diff --git a/mflix/server/java-spring/src/main/java/com/mongodb/samplemflix/model/Theater.java b/mflix/server/java-spring/src/main/java/com/mongodb/samplemflix/model/Theater.java deleted file mode 100644 index c0d2045..0000000 --- a/mflix/server/java-spring/src/main/java/com/mongodb/samplemflix/model/Theater.java +++ /dev/null @@ -1,119 +0,0 @@ -package com.mongodb.samplemflix.model; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; -import org.bson.types.ObjectId; -import org.springframework.data.annotation.Id; -import org.springframework.data.mongodb.core.mapping.Document; - -/** - * Domain model representing a theater document from the MongoDB theaters collection. - * - *

This class maps to the theaters collection in the sample_mflix database. - * It includes location information with address and geospatial coordinates. - * - *

TODO: Implement Theater functionality: - * - Create TheaterRepository extending MongoRepository - * - Create TheaterService and TheaterServiceImpl - * - Create TheaterController with REST endpoints - * - Implement geospatial queries (findNear, findWithinRadius) - * - Add validation annotations - * - Add unit tests for Theater service and controller - * - Add integration tests with geospatial queries - * - Add GeoJSON support for location queries - */ -@Data -@Builder -@NoArgsConstructor -@AllArgsConstructor -@Document(collection = "theaters") -public class Theater { - - /** - * MongoDB document ID. - * Maps to the _id field in MongoDB. - */ - @Id - private ObjectId id; - - /** - * Theater ID number. - */ - private Integer theaterId; - - /** - * Location information including address and geospatial coordinates. - */ - private Location location; - - /** - * Nested class representing location information. - */ - @Data - @Builder - @NoArgsConstructor - @AllArgsConstructor - public static class Location { - /** - * Address information. - */ - private Address address; - - /** - * Geospatial coordinates. - */ - private Geo geo; - - /** - * Nested class for address information. - */ - @Data - @Builder - @NoArgsConstructor - @AllArgsConstructor - public static class Address { - /** - * Street address line 1. - */ - private String street1; - - /** - * City name. - */ - private String city; - - /** - * State or province. - */ - private String state; - - /** - * ZIP or postal code. - */ - private String zipcode; - } - - /** - * Nested class for geospatial coordinates. - * Uses GeoJSON format for MongoDB geospatial queries. - */ - @Data - @Builder - @NoArgsConstructor - @AllArgsConstructor - public static class Geo { - /** - * GeoJSON type (always "Point" for theater locations). - */ - private String type; - - /** - * Coordinates array: [longitude, latitude]. - * Note: GeoJSON uses longitude first, then latitude. - */ - private double[] coordinates; - } - } -} diff --git a/mflix/server/java-spring/src/main/java/com/mongodb/samplemflix/model/dto/MovieWithCommentsResult.java b/mflix/server/java-spring/src/main/java/com/mongodb/samplemflix/model/dto/MovieWithCommentsResult.java index ede0b30..62e70c4 100644 --- a/mflix/server/java-spring/src/main/java/com/mongodb/samplemflix/model/dto/MovieWithCommentsResult.java +++ b/mflix/server/java-spring/src/main/java/com/mongodb/samplemflix/model/dto/MovieWithCommentsResult.java @@ -24,7 +24,7 @@ public class MovieWithCommentsResult { /** * Movie ID as string. */ - private String id; + private String _id; /** * Movie title. @@ -52,9 +52,9 @@ public class MovieWithCommentsResult { private List genres; /** - * IMDB rating information. + * IMDB rating (0.0 to 10.0). */ - private ImdbInfo imdb; + private Double imdbRating; /** * Most recent comments for this movie. @@ -71,25 +71,6 @@ public class MovieWithCommentsResult { */ private Date mostRecentCommentDate; - /** - * Nested class for IMDB information. - */ - @Data - @Builder - @NoArgsConstructor - @AllArgsConstructor - public static class ImdbInfo { - /** - * IMDB rating (0.0 to 10.0). - */ - private Double rating; - - /** - * Number of votes. - */ - private Integer votes; - } - /** * Nested class for comment information. */ diff --git a/mflix/server/java-spring/src/main/java/com/mongodb/samplemflix/service/MovieServiceImpl.java b/mflix/server/java-spring/src/main/java/com/mongodb/samplemflix/service/MovieServiceImpl.java index eb592a0..624fa36 100644 --- a/mflix/server/java-spring/src/main/java/com/mongodb/samplemflix/service/MovieServiceImpl.java +++ b/mflix/server/java-spring/src/main/java/com/mongodb/samplemflix/service/MovieServiceImpl.java @@ -412,13 +412,13 @@ public List getMoviesWithMostRecentComments(Integer lim // STAGE 7: Project final output with recent comments slice // Shape the response and include only the 5 most recent comments per movie Aggregation.project() - .and(ConditionalOperators.ifNull("_id").then("")).as("id") + .and(ConditionalOperators.ifNull("_id").then("")).as("_id") .and("title").as("title") .and("year").as("year") .and("plot").as("plot") .and("poster").as("poster") .and("genres").as("genres") - .and("imdb").as("imdb") + .and("imdb.rating").as("imdbRating") .and(ArrayOperators.Slice.sliceArrayOf("comments").itemCount(5)).as("recentComments") .and("totalComments").as("totalComments") .and("mostRecentCommentDate").as("mostRecentCommentDate") @@ -540,15 +540,8 @@ public List getDirectorsWithMostMovies(Integer limit) * Helper method to map Document to MovieWithCommentsResult. */ private MovieWithCommentsResult mapToMovieWithCommentsResult(Document doc) { - // Extract IMDB info - MovieWithCommentsResult.ImdbInfo imdbInfo = null; - Document imdbDoc = doc.get("imdb", Document.class); - if (imdbDoc != null) { - imdbInfo = MovieWithCommentsResult.ImdbInfo.builder() - .rating(imdbDoc.getDouble("rating")) - .votes(imdbDoc.getInteger("votes")) - .build(); - } + // Extract IMDB rating (just the number) + Double imdbRating = doc.getDouble("imdbRating"); // Extract recent comments List recentComments = null; @@ -569,7 +562,7 @@ private MovieWithCommentsResult mapToMovieWithCommentsResult(Document doc) { // Extract movie ID - handle both String and ObjectId types String movieId = null; - Object idObj = doc.get("id"); + Object idObj = doc.get("_id"); if (idObj instanceof String) { movieId = (String) idObj; } else if (idObj instanceof ObjectId) { @@ -577,13 +570,13 @@ private MovieWithCommentsResult mapToMovieWithCommentsResult(Document doc) { } return MovieWithCommentsResult.builder() - .id(movieId) + ._id(movieId) .title(doc.getString("title")) .year(doc.getInteger("year")) .plot(doc.getString("plot")) .poster(doc.getString("poster")) .genres(doc.getList("genres", String.class)) - .imdb(imdbInfo) + .imdbRating(imdbRating) .recentComments(recentComments) .totalComments(doc.getInteger("totalComments")) .mostRecentCommentDate(doc.getDate("mostRecentCommentDate")) @@ -719,8 +712,6 @@ public List searchMovies(MovieSearchRequest searchRequest) { } } - - // TODO: Implement vector search @Override public List findSimilarMovies(String movieId, Integer limit) { // Validate movie ID diff --git a/mflix/server/java-spring/src/main/java/com/mongodb/samplemflix/util/ValidationUtils.java b/mflix/server/java-spring/src/main/java/com/mongodb/samplemflix/util/ValidationUtils.java deleted file mode 100644 index a496b14..0000000 --- a/mflix/server/java-spring/src/main/java/com/mongodb/samplemflix/util/ValidationUtils.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.mongodb.samplemflix.util; - -/** - * Utility class for validation operations. - * - * This class provides helper methods for validating request data. - * - * TODO: Implement validation utility methods: - * - ObjectId format validation - * - Date range validation - * - String sanitization - * - URL validation - */ -public class ValidationUtils { - - private ValidationUtils() { - // Private constructor to prevent instantiation - } - - // TODO: Add ObjectId validation (currently duplicated in service layer) - // public static boolean isValidObjectId(String id) - - // TODO: Add string sanitization for XSS prevention - // public static String sanitize(String input) - - // TODO: Add URL validation for poster and trailer fields - // public static boolean isValidUrl(String url) -} diff --git a/mflix/server/java-spring/src/test/java/com/mongodb/samplemflix/controller/MovieControllerTest.java b/mflix/server/java-spring/src/test/java/com/mongodb/samplemflix/controller/MovieControllerTest.java index acc1542..0f63dfd 100644 --- a/mflix/server/java-spring/src/test/java/com/mongodb/samplemflix/controller/MovieControllerTest.java +++ b/mflix/server/java-spring/src/test/java/com/mongodb/samplemflix/controller/MovieControllerTest.java @@ -335,7 +335,7 @@ void testFindAndDeleteMovie_NotFound() throws Exception { // ==================== AGGREGATION ENDPOINT TESTS ==================== @Test - @DisplayName("GET /api/movies/aggregations/comments - Should return movies with most comments") + @DisplayName("GET /api/movies/aggregations/reportingByComments - Should return movies with most comments") void testGetMoviesWithMostComments_Success() throws Exception { // Arrange MovieWithCommentsResult.CommentInfo comment = MovieWithCommentsResult.CommentInfo.builder() @@ -346,19 +346,14 @@ void testGetMoviesWithMostComments_Success() throws Exception { .date(new Date()) .build(); - MovieWithCommentsResult.ImdbInfo imdb = MovieWithCommentsResult.ImdbInfo.builder() - .rating(8.5) - .votes(1000) - .build(); - MovieWithCommentsResult result = MovieWithCommentsResult.builder() - .id(testId.toHexString()) + ._id(testId.toHexString()) .title("Test Movie") .year(2024) .plot("Test plot") .poster("http://example.com/poster.jpg") .genres(Arrays.asList("Action", "Drama")) - .imdb(imdb) + .imdbRating(8.5) .recentComments(Arrays.asList(comment)) .totalComments(5) .mostRecentCommentDate(new Date()) @@ -367,7 +362,7 @@ void testGetMoviesWithMostComments_Success() throws Exception { when(movieService.getMoviesWithMostRecentComments(anyInt(), isNull())).thenReturn(Arrays.asList(result)); // Act & Assert - mockMvc.perform(get("/api/movies/aggregations/comments")) + mockMvc.perform(get("/api/movies/aggregations/reportingByComments")) .andExpect(status().isOk()) .andExpect(jsonPath("$.success").value(true)) .andExpect(jsonPath("$.data").isArray()) @@ -380,13 +375,13 @@ void testGetMoviesWithMostComments_Success() throws Exception { } @Test - @DisplayName("GET /api/movies/aggregations/comments - Should accept limit parameter") + @DisplayName("GET /api/movies/aggregations/reportingByComments - Should accept limit parameter") void testGetMoviesWithMostComments_WithLimit() throws Exception { // Arrange when(movieService.getMoviesWithMostRecentComments(eq(5), isNull())).thenReturn(Arrays.asList()); // Act & Assert - mockMvc.perform(get("/api/movies/aggregations/comments") + mockMvc.perform(get("/api/movies/aggregations/reportingByComments") .param("limit", "5")) .andExpect(status().isOk()) .andExpect(jsonPath("$.success").value(true)) @@ -394,14 +389,14 @@ void testGetMoviesWithMostComments_WithLimit() throws Exception { } @Test - @DisplayName("GET /api/movies/aggregations/comments - Should accept movieId parameter") + @DisplayName("GET /api/movies/aggregations/reportingByComments - Should accept movieId parameter") void testGetMoviesWithMostComments_WithMovieId() throws Exception { // Arrange String movieId = testId.toHexString(); when(movieService.getMoviesWithMostRecentComments(anyInt(), eq(movieId))).thenReturn(Arrays.asList()); // Act & Assert - mockMvc.perform(get("/api/movies/aggregations/comments") + mockMvc.perform(get("/api/movies/aggregations/reportingByComments") .param("movieId", movieId)) .andExpect(status().isOk()) .andExpect(jsonPath("$.success").value(true)) @@ -409,7 +404,7 @@ void testGetMoviesWithMostComments_WithMovieId() throws Exception { } @Test - @DisplayName("GET /api/movies/aggregations/comments - Should return 400 for invalid movieId") + @DisplayName("GET /api/movies/aggregations/reportingByComments - Should return 400 for invalid movieId") void testGetMoviesWithMostComments_InvalidMovieId() throws Exception { // Arrange String invalidMovieId = "invalid-id"; @@ -417,7 +412,7 @@ void testGetMoviesWithMostComments_InvalidMovieId() throws Exception { .thenThrow(new ValidationException("Invalid movie ID format")); // Act & Assert - mockMvc.perform(get("/api/movies/aggregations/comments") + mockMvc.perform(get("/api/movies/aggregations/reportingByComments") .param("movieId", invalidMovieId)) .andExpect(status().isBadRequest()) .andExpect(jsonPath("$.success").value(false)) @@ -425,7 +420,7 @@ void testGetMoviesWithMostComments_InvalidMovieId() throws Exception { } @Test - @DisplayName("GET /api/movies/aggregations/years - Should return movies by year with statistics") + @DisplayName("GET /api/movies/aggregations/reportingByYear - Should return movies by year with statistics") void testGetMoviesByYearWithStats_Success() throws Exception { // Arrange MoviesByYearResult result1 = MoviesByYearResult.builder() @@ -449,7 +444,7 @@ void testGetMoviesByYearWithStats_Success() throws Exception { when(movieService.getMoviesByYearWithStats()).thenReturn(Arrays.asList(result1, result2)); // Act & Assert - mockMvc.perform(get("/api/movies/aggregations/years")) + mockMvc.perform(get("/api/movies/aggregations/reportingByYear")) .andExpect(status().isOk()) .andExpect(jsonPath("$.success").value(true)) .andExpect(jsonPath("$.data").isArray()) @@ -462,7 +457,7 @@ void testGetMoviesByYearWithStats_Success() throws Exception { } @Test - @DisplayName("GET /api/movies/aggregations/directors - Should return directors with most movies") + @DisplayName("GET /api/movies/aggregations/reportingByDirectors - Should return directors with most movies") void testGetDirectorsWithMostMovies_Success() throws Exception { // Arrange DirectorStatisticsResult result1 = DirectorStatisticsResult.builder() @@ -480,7 +475,7 @@ void testGetDirectorsWithMostMovies_Success() throws Exception { when(movieService.getDirectorsWithMostMovies(anyInt())).thenReturn(Arrays.asList(result1, result2)); // Act & Assert - mockMvc.perform(get("/api/movies/aggregations/directors")) + mockMvc.perform(get("/api/movies/aggregations/reportingByDirectors")) .andExpect(status().isOk()) .andExpect(jsonPath("$.success").value(true)) .andExpect(jsonPath("$.data").isArray()) @@ -493,13 +488,13 @@ void testGetDirectorsWithMostMovies_Success() throws Exception { } @Test - @DisplayName("GET /api/movies/aggregations/directors - Should accept limit parameter") + @DisplayName("GET /api/movies/aggregations/reportingByDirectors - Should accept limit parameter") void testGetDirectorsWithMostMovies_WithLimit() throws Exception { // Arrange when(movieService.getDirectorsWithMostMovies(eq(10))).thenReturn(Arrays.asList()); // Act & Assert - mockMvc.perform(get("/api/movies/aggregations/directors") + mockMvc.perform(get("/api/movies/aggregations/reportingByDirectors") .param("limit", "10")) .andExpect(status().isOk()) .andExpect(jsonPath("$.success").value(true)) diff --git a/mflix/server/java-spring/src/test/java/com/mongodb/samplemflix/integration/MovieIntegrationTest.java b/mflix/server/java-spring/src/test/java/com/mongodb/samplemflix/integration/MovieIntegrationTest.java deleted file mode 100644 index 91f86fe..0000000 --- a/mflix/server/java-spring/src/test/java/com/mongodb/samplemflix/integration/MovieIntegrationTest.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.mongodb.samplemflix.integration; - -/** - * Integration tests for the movie API. - * - * These tests verify the full request/response cycle including database operations. - * - * TODO: Set up Testcontainers for MongoDB - * - Add testcontainers dependency to pom.xml - * - Configure MongoDB test container - * - Set up test data initialization - * - * TODO: Implement integration tests for all endpoints: - * - GET /api/movies (with various filters) - * - GET /api/movies/{id} - * - POST /api/movies - * - POST /api/movies/batch - * - PATCH /api/movies/{id} - * - PATCH /api/movies - * - DELETE /api/movies/{id} - * - DELETE /api/movies - * - DELETE /api/movies/{id}/find-and-delete - * - * TODO: Implement integration tests for aggregation endpoints: - * - GET /api/movies/aggregations/comments (with and without limit/movieId) - * - GET /api/movies/aggregations/years - * - GET /api/movies/aggregations/directors (with and without limit) - * - * TODO: Test error scenarios: - * - Invalid ObjectId format - * - Resource not found - * - Validation errors - * - Database connection failures - * - * TODO: Test performance: - * - Large dataset queries - * - Pagination performance - * - Text search performance - * - Aggregation pipeline performance - */ -public class MovieIntegrationTest { - - // TODO: Add @SpringBootTest annotation - // TODO: Add @Testcontainers annotation - // TODO: Add MongoDB container configuration - // TODO: Add test data setup methods - // TODO: Add integration test methods for CRUD operations - // TODO: Add integration test methods for aggregation endpoints -} diff --git a/mflix/server/java-spring/src/test/java/com/mongodb/samplemflix/service/MovieServiceTest.java b/mflix/server/java-spring/src/test/java/com/mongodb/samplemflix/service/MovieServiceTest.java index 4371dbf..d68e202 100644 --- a/mflix/server/java-spring/src/test/java/com/mongodb/samplemflix/service/MovieServiceTest.java +++ b/mflix/server/java-spring/src/test/java/com/mongodb/samplemflix/service/MovieServiceTest.java @@ -443,13 +443,13 @@ void testGetMoviesWithMostRecentComments_Success() { String movieId = null; Document doc1 = new Document() - .append("id", testId.toHexString()) + .append("_id", testId.toHexString()) .append("title", "Test Movie") .append("year", 2024) .append("plot", "Test plot") .append("poster", "http://example.com/poster.jpg") .append("genres", Arrays.asList("Action", "Drama")) - .append("imdb", new Document("rating", 8.5).append("votes", 1000)) + .append("imdbRating", 8.5) .append("recentComments", Arrays.asList( new Document() .append("_id", new ObjectId()) diff --git a/mflix/server/js-express/package.json b/mflix/server/js-express/package.json index 151b911..01311ba 100644 --- a/mflix/server/js-express/package.json +++ b/mflix/server/js-express/package.json @@ -3,7 +3,7 @@ "version": "1.0.0", "description": "Express.js backend for MongoDB sample mflix application demonstrating CRUD operations, aggregations, search, and geospatial queries", "license": "Apache-2.0", - "author": "Jordan Smith", + "author": "MongoDB Documentation Team", "type": "commonjs", "main": "dist/app.js", "scripts": {