default function in schema without context
See original GitHub issuehi,
default function in the schema has currently no way to access the document.
var m = require('mongoose');
var schema = new m.Schema({
a: {
type: Number,
default: function() {
console.log(this);
}
}
});
var Model = m.model('mymodel', schema);
new Model();
Issue Analytics
- State:
- Created 10 years ago
- Reactions:1
- Comments:11 (1 by maintainers)
Top Results From Across the Web
Setting schema name for DbContext - Stack Overflow
You can configure the default schema in OnModelCreating method of your custom inherited DbContext class like -
Read more >Resolvers - Apollo GraphQL Docs
A resolver is a function that's responsible for populating the data for a single field in ... Apollo Server automatically defines a default...
Read more >Documentation: 15: 5.9. Schemas - PostgreSQL
The first schema in the search path that exists is the default location for creating new objects. That is the reason that by...
Read more >Entity Types - EF Core - Microsoft Learn
When using a relational database, tables are by convention created in your database's default schema. For example, Microsoft SQL Server will use ...
Read more >Ecto.Schema — Ecto v3.9.4 - HexDocs
For example, you can use such schemas to receive data from a command line interface and validate it, without ever persisting it elsewhere....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This was resolved in #6119.
1581.js
Output
Is there any plans on adding this? Not sure if thats expected or actually a bug, noticed this issue was opened back in 2013. Confirmed was an issue with 4.x and still an issue on 5.x.