-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
Allow schema
as a schema path name
#8798
Comments
@AbdelrahmanHafez Thanks for you answer, I am working on service migration. If the schema field already exists in the original database, how should I deal with this situation? |
In that case I would rename the schema field into a different field name. |
@AbdelrahmanHafez Maybe another mongo client is a better solution. |
I can't make that choice for you, depending on the effort of renaming the field, and the features mongoose provides. See what outweighs what, and make your decision. Perhaps @vkarpov15 has a better idea. |
@AbdelrahmanHafez thanks! |
Some path names unfortunately do conflict with existing methods and properties. However, there are ways for us to work around this. I'll keep this open for a future release. |
schema
as a schema path name
@vkarpov15 Can I take up this issue to work on? |
@JatinRanka sure 👍 |
Hi, @vkarpov15 I am a newbie to this project and would like to contribute it; do you think you can put me in the right direction, please? |
@Edu93Jer sure. The general idea is that several methods in |
@vkarpov15 when you say "changing the name of the 'schema' property on documents to '$__schema' " you mean in all the documents or just where the property is added, because I just did this, and the issue works well. (Line 592) |
That's one step. But the reason why Line 104 in 645a45b
Any change to |
In |
Do you want to request a feature or report a bug?
Bug
What is the current behavior?
When i set schema name
schema
,mongoose throw err
mongoose/lib/schema.js
line 528If the current behavior is a bug, please provide the steps to reproduce.
const schema = new Schema({ 'schema': { type: String, default: '{}'}, });
What is the expected behavior?
I can set name
schema
in SchemaWhat are the versions of Node.js, Mongoose and MongoDB you are using? Note that "latest" is not a version.
Mongoose version 5.4.7
5.9.9 alse have this problem
https://github.com/Automattic/mongoose/blob/master/lib/schema.js#L645
Nodejs version 12
The text was updated successfully, but these errors were encountered: