Skip to content

Uncaught (in promise) Error: bad key in untransform: __v #5928 #5929

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

Closed
rameshkec85 opened this issue Aug 16, 2019 · 2 comments
Closed

Uncaught (in promise) Error: bad key in untransform: __v #5928 #5929

rameshkec85 opened this issue Aug 16, 2019 · 2 comments

Comments

@rameshkec85
Copy link

Issue Description

Getting this issue while i am trying to add existing mongodb to parse-server :

Uncaught (in promise) Error: bad key in untransform: __v #5928

Steps to reproduce

Mongodb tables have this key : '__v' when i am using mongoose

Expected Results

Should allow migrate and see the results of the particular class

Actual Outcome

Getting below issue:
Mongodb tables have this key : '__v' when i am using mongoose

  • if any table has not have ' __v' key , tables data shown in the parse-dashboard

Environment Setup

  • Server

    • parse-server version : 3.7.2
    • Operating System: Mac OS 10.13.6
    • Hardware:
    • Localhost or remote server? Local
  • Database

    • MongoDB version: Latest Version
    • Storage engine: -
    • Hardware: -
    • Localhost or remote server? Remote(Directly i have added remote mongo db url in environment variabls)

Logs/Trace

Uncaught (in promise) Error: bad key in untransform: __v #5928

@davimacedo
Copy link
Member

Fields starting with _ are reserved for Parse Server usage. You will have to get rid of these fields before connecting Parse Server to your database.

@EhsanParsania
Copy link
Member

You can fix this with two steps:

  1. Removing __v from your existing documents:
    db.collection('CLASSNAME').updateMany({}, { $unset: { __v: 1 } });
  2. Deactivate version key from schema's option
const yourSchema = new mongoose.Schema({
    // Your other fields here
  }, {
    versionKey: false // This will disable the "__v" field
  });
  const YourModel = mongoose.model('YourModel', yourSchema);

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

3 participants