question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Allow `schema` as a schema path name

See original GitHub issue

Do you want to request a feature or report a bug? Bug

What is the current behavior? When i set schema name schema, image

mongoose throw err image

mongoose/lib/schema.js line 528

image

If 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 Schema What 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

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:14

github_iconTop GitHub Comments

2reactions
AbdelrahmanHafezcommented, Apr 18, 2020

In that case I would rename the schema field into a different field name. I’ve always found thesaurus quite helpful in finding synonyms.

1reaction
vkarpov15commented, Apr 23, 2020

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Documentation: 15: 5.9. Schemas - PostgreSQL
To allow many users to use one database without interfering with each other. ... The first schema named in the search path is...
Read more >
Mongoose v6.8.2: Schemas
In these cases, Mongoose only creates actual schema paths for leaves in the tree. ... define a schema const animalSchema = new Schema({...
Read more >
Introduction to Mongoose Schemas - Mastering JS
This object defines what paths a schema has. For example, the below userSchema has a name path and an age path.
Read more >
node.js - `options` may not be used as a schema pathname
Mongoose has a number of Reserved schema names that can't be used, to avoid conflicting with Mongoose's internal implementation.
Read more >
Structuring a complex schema — Understanding JSON ...
Complex parts of the schema can be defined in $defs with descriptive names and referenced where it's needed. This allows readers of the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found