Add option to merge rather than overwrite schema-level `populate()` options
See original GitHub issuePrerequisites
- I have written a descriptive issue title
- I have searched existing issues to ensure the issue has not already been raised
Issue
hi, i have two schemas with below descriptions
User Schema
class User {
@Prop() _id: number;
@Prop() events: object; // it has two keys : create and delete
}
Custom Schema
class Custom {
@Prop() _id: number;
@Prop() user_id: number
}
CustomSchema.virtual('user' , {
ref: 'user',
localField: 'user_id',
foreignField: '_id',
options: {
match: {
'events.delete': null
}
}
})
custom schema has relation with user which is defined via a virtual.
How to produce problem
run this query :
custom.findOne({ _id:1 }).populate({ path: 'user, match: {'events.create': {$ne : null } } }).exec();
Expected behavior
populate user if events.delete
is null and events.create
is not null
Result
populate user if events.create
is not null
What is the problem?
match defined in populate overwrites match defined in virtual. how to append match defined in populate with match defined in virtual?
thanks.
Issue Analytics
- State:
- Created a year ago
- Comments:5
Top Results From Across the Web
Appending/Overwriting with Different Schema to Delta Lake ...
Attempting to add data to a Delta file that has different schema ( different column names, differnt data types, etc) will cause Delta...
Read more >Diving Into Delta Lake: Schema Enforcement & Evolution
Learn how schema enforcement and schema evolution work together on Delta Lake to ensure high quality, reliable data.
Read more >Setting crawler configuration options - AWS Glue
If you are configuring the crawler on the console, to combine schemas, select the crawler option Create a single schema for each S3...
Read more >MERGE (Transact-SQL) - SQL Server - Microsoft Learn
Runs insert, update, or delete operations on a target table from the ... The MERGE statement can't update the same row more than...
Read more >4. Spark SQL and DataFrames: Introduction to Built-in Data ...
In Python from pyspark.sql import SparkSession # Create a SparkSession spark ... Instead of having a separate metastore for Spark tables, Spark by...
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
We should add an option to merge rather than overwrite properties in
populate()
.Right now we don’t have an easy workaround. The best option would be to store the schema-level match as a variable, and merge it manually: