Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Duplicate Key Error in MongoDB During Import of streaming-history.json in Docker Container #312

Open
xFrenchGamer73 opened this issue Nov 20, 2023 · 2 comments

Comments

@xFrenchGamer73
Copy link

Hi,

I'm facing an issue with a MongoDB instance running in a Docker container. The problem arises when I attempt to import data from a streaming-history.json file into the tracks collection of my your_spotify database. I'm encountering a duplicate key error as follows:

image

This error occurs specifically during the import process of the streaming-history.json file, causing data insertion failures due to a conflict with the id field, which is supposed to be unique.

I am seeking advice on how to handle this issue, especially considering it seems to be related to MongoDB's handling of unique indexes within a containerized environment. Any tips on managing duplicate keys during JSON data import, or on configuring MongoDB in Docker to avoid such conflicts, would be highly appreciated.

Thank you for your assistance!

@xFrenchGamer73
Copy link
Author

Compose file

version: "3"

services:
  server:
    image: yooooomi/your_spotify_server
    restart: always
    ports:
      - "8080:8080"
    links:
      - mongo
    depends_on:
      - mongo
    environment:
      API_ENDPOINT: http://192.168.1.2:8080 # This MUST be included as a valid URL in the spotify dashboard (see below)
      CLIENT_ENDPOINT: http://192.168.1.2:3000
      SPOTIFY_PUBLIC: 
      SPOTIFY_SECRET: 
  mongo:
    container_name: mongo
    image: mongo:6
    volumes:
      - ./your_spotify_db:/data/db

  web:
    image: yooooomi/your_spotify_client
    restart: always
    ports:
      - "3000:3000"
    environment:
      API_ENDPOINT: http://192.168.1.2:8080

@Yooooomi
Copy link
Owner

Hello! It seems related to my implementation of importing streaming history.
If you don't mind sending your failing file to yooooomi_ on discord, it would be greatly appreciated and save me a bit of time. Also, are you importing normal history or extended one?
Thanks a lot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants