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

Saving a model fails with mongo error: MongoError: Unknown modifier: #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

shingi
Copy link

@shingi shingi commented Feb 17, 2018

No description provided.

@shingi
Copy link
Author

shingi commented Feb 17, 2018

Issue reported here: Automattic/mongoose#5574

@amy-dredge-ps
Copy link

Thanks for this information @shingi! Since I can't repro, can you try updating mongoose to major version 5 and let me know if that resolves it? If not, I'll merge the pull request. If version 5 of mongoose fixes it, let me know and I'll upgrade mongoose in the repository.

@rennanbadaro
Copy link

Hey @adredge @shingi , I had the same problem and updating mongoose didn't solve it.
What worked for me was to install the same version of Mongo you're using in the video(3.4.x).

@shingi
Copy link
Author

shingi commented Feb 18, 2018

@rennanbadaro I don't get this particular error in Mongoose 5 but it looks there are issues related to how promises are supported in Mongoose 5 and I get the error Cannot read property 'then' of undefined. Also, use of { useMongoClient: true } is no longer supported.

@amy-dredge-ps
Copy link

Hi @rennanbadaro. Per the dependencies in the root package.json, this app was written using mongoose ^4.11. Using version 5 does not comply with the versioning there in the package.json. Of course, you're free to use whatever version you want, but I can't guarantee things will work. I will likely upgrade the app and its dependencies as time goes on. However, since it sounds like upgrading to mongoose 5 will require some significant code changes, I don't want to do that at this time. I want to keep my code in this repo consistent with the code I show in my course, and changing the structure (i.e. promises) of the code is not a good move at this time. If you want to do that however, please feel free. I'd even enjoy seeing a PR to understand what's involved.

@rennanbadaro
Copy link

Hey @adredge, I was talking about the database actually, not mongoose
Installing via brew gave me a newer version of MongoDB compared to the one you used in the video. Once I installed the same version you showed everything worked just fine

@adredge
Copy link
Owner

adredge commented Feb 23, 2018

Alright, going to merge in the other PR that is very similar to this (this one just has an unrelated change to the .gitignore).

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

Successfully merging this pull request may close these issues.

None yet

4 participants