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.

Autovalue not run for fields in an array of embedded documents when specified with a positional ("$") operator

See original GitHub issue

Given a document with a field specified as an array of embedded documents, like so:

SubSchema = new SimpleSchema({
  value: {
    type: String,
    autoValue: function() {
      return "autovalue";
    }
  }
});

TestSchema = new SimpleSchema({
  children: {
    type: [SubSchema]
  }
});

A modifier that updates a value within a single embedded document specified with a position operator (‘$’) will not trigger the autovalue. That is, the following doesn’t call the autovalue function:

var mod = {
  $set: {"children.$.value": "should be overridden by autovalue"}
};
TestSchema.clean(mod, {isModifier: true});

Complete repro is at https://github.com/fongandrew/meteor-simple-schema-array-test

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:32

github_iconTop GitHub Comments

5reactions
micha1983commented, Sep 18, 2016

Has somebody tested this. for me it’s still not working.

3reactions
0o-de-lallycommented, Jun 8, 2016

+1 seems like the pull request has passing tests. Any reason not to merge it? It will soon be one year since the pull request was made.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Autovalue not run for fields in an array of embedded ... - GitHub
Given a document with a field specified as an array of embedded documents ... with a position operator ('$') will not trigger the...
Read more >
Hibernate ORM 6.0.0.CR1 User Guide - Red Hat on GitHub
Hibernate not only takes care of the mapping from Java classes to database ... value's ordinal position within the enum class, as indicated...
Read more >
How to get specific values of an embedded document Array in ...
what I tried to is getting all sitename from every embedded documents in the array.I have tried using following syntax ...
Read more >
Lingo4G, clustering engine reference
The list of label clusters produced by Lingo4G does not come with document (members of each cluster). This gives the specific application the...
Read more >
AutoValue Changes
It is now an error if @Memoized is applied to a method not inside an @AutoValue class. Type annotations are now handled more...
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