Partial load of movie database

When I download the sample DB, I only get ‘23539’ documents in the movie collection.
As a result I only get 2 passes and 1 fail for the first unittest.

I deleted the data and loaded the data again but same result

Any suggestions?
thx Peter

LOG:
MacBook-Pro-van-Peter:mflix-js-master tribp$ npm test -t db-connection

server@1.0.0 test /Users/tribp/Library/Mobile Documents/com~apple~CloudDocs/Data/Opleiding/mongoDB/mflix-js-master
jest --passWithNoTests “db-connection”

Determining test suites to run…Setup Mongo Connection
(node:1731) DeprecationWarning: current Server Discovery and Monitoring engine is deprecated, and will be removed in a future version. To use the new Server Discover and Monitoring engine, pass option { useUnifiedTopology: true } to MongoClient.connect.
FAIL test/db-connection.test.js
Connection
✓ Can access MFlix data (141ms)
✓ Can retrieve a movie by id (119ms)
✕ Can retrieve first page of movies (519ms)

● Connection › Can retrieve first page of movies

expect(received).toEqual(expected)

Expected value to equal:
  45993
Received:
  23539

Hey @Peter_14588

Could this post help?

I think there is a bit of a mix up.

1 Like

Same result: only 23539 documents in movie db

  • I deleted all my existing collections
  • I downloaded your link
  • mongorestore --drop --gzip --uri “mongodb+srv://m220student:XXXXX@mflix-hpsmx.mongodb.net/tes” data

Any suggestions?

Hey @Peter_14588

It is not the data in the database that is wrong it is the test code,. For some reason there was a change in the number of documents. You will need to delete the folder you created and download the m220/mflix-js.zip file and unzip it again.

Then go into the test folder and check out the db-connection.js file to verify that it say that the total should be 23539

Old Version

  test("Can retrieve first page of movies", async () => {
    const {
      moviesList: firstPage,
      totalNumMovies: numMovies,
    } = await MoviesDAO.getMovies()
    expect(firstPage.length).toEqual(20)
    expect(numMovies).toEqual(45993)
  })

New VERSION and the one you want

  test("Can retrieve first page of movies", async () => {
    const {
      moviesList: firstPage,
      totalNumMovies: numMovies,
    } = await MoviesDAO.getMovies()
    expect(firstPage.length).toEqual(20)
    expect(numMovies).toEqual(23539)
  })
1 Like