Thinking about text entry as
- Last 7 days
-
glassmanlab.seas.harvard.edu glassmanlab.seas.harvard.edu
-
- Dec 2025
-
medium.com medium.com
-
for - Medium article - cogress - Part 1 - progress trap - James Gien Wong - definition - cogress - to - Medium article cogress - Part 2 - progress trap - James Gien Wong - https://hyp.is/t8FhpDGAEfC4J7f0NEFujg/medium.com/@gien_SRG/human-cogress-part-2-d6fd075a55c7 - to - Stop Reset Go hypothesis annotations - progress trap - Ronald Wright - https://jonudell.info/h/facet/?max=100&expanded=true&user=stopresetgo&exactTagSearch=true&any=ronald+wright - General - https://jonudell.info/h/facet/?max=100&expanded=true&user=stopresetgo&exactTagSearch=true&any=progress+trap - from - youtube - Planet Critical interview - Samuel Miller MacDonald - The Myth of Progress - https://hyp.is/r-hmFtjKEfCd8odATbINbA/www.youtube.com/watch?v=BEhmWEDkZUQ
Tags
- definition - cogress
- from - youtube - Planet Critical interview - Samuel Miller MacDonald - The Myth of Progress
- to - Medium article cogress - Part 2 - progress trap - James Gien Wong
- Medium article - cogress - Part 1 - progress trap - James Gien Wong
- to - Stop Reset Go hypothesis annotations - progress trap
Annotators
URL
-
- May 2025
-
medium.com medium.com
-
for - definition - cogress - Medium article - Cogress - Part 2 - Stop Reset Go - Deep Humanity - James Gien Wong - from - Medium article - Cogress - Part 1 - Stop Reset Go - Deep Humanity - James Gien Wong - https://hyp.is/_Nyg2DF_EfCBeu_iuDroYg/medium.com/@gien_SRG/human-cogress-part-1-5159a575e1c4 - to - Stop Reset Go hypothesis annotations - progress trap - Ronald Wright - https://jonudell.info/h/facet/?max=100&expanded=true&user=stopresetgo&exactTagSearch=true&any=ronald+wright - General - https://jonudell.info/h/facet/?max=100&expanded=true&user=stopresetgo&exactTagSearch=true&any=progress+trap
-
- Nov 2024
-
www.columbia.edu www.columbia.edu
-
The “tipping point” concept, implying an unstable climate response, is misused and overused,thus encouraging a fatalistic public response or climate change denial.41
for - climate crisis - planetary tipping points - irreversible? - Hansen disagrees - part 1
-
- Jan 2024
-
mongoosejs.com mongoosejs.com
-
Instance methods Instances of Models are documents. Documents have many of their own built-in instance methods. We may also define our own custom document instance methods. // define a schema const animalSchema = new Schema({ name: String, type: String }, { // Assign a function to the "methods" object of our animalSchema through schema options. // By following this approach, there is no need to create a separate TS type to define the type of the instance functions. methods: { findSimilarTypes(cb) { return mongoose.model('Animal').find({ type: this.type }, cb); } } }); // Or, assign a function to the "methods" object of our animalSchema animalSchema.methods.findSimilarTypes = function(cb) { return mongoose.model('Animal').find({ type: this.type }, cb); }; Now all of our animal instances have a findSimilarTypes method available to them. const Animal = mongoose.model('Animal', animalSchema); const dog = new Animal({ type: 'dog' }); dog.findSimilarTypes((err, dogs) => { console.log(dogs); // woof }); Overwriting a default mongoose document method may lead to unpredictable results. See this for more details. The example above uses the Schema.methods object directly to save an instance method. You can also use the Schema.method() helper as described here. Do not declare methods using ES6 arrow functions (=>). Arrow functions explicitly prevent binding this, so your method will not have access to the document and the above examples will not work.
Certainly! Let's break down the provided code snippets:
1. What is it and why is it used?
In Mongoose, a schema is a blueprint for defining the structure of documents within a collection. When you define a schema, you can also attach methods to it. These methods become instance methods, meaning they are available on the individual documents (instances) created from that schema.
Instance methods are useful for encapsulating functionality related to a specific document or model instance. They allow you to define custom behavior that can be executed on a specific document. In the given example, the
findSimilarTypesmethod is added to instances of theAnimalmodel, making it easy to find other animals of the same type.2. Syntax:
Using
methodsobject directly in the schema options:javascript const animalSchema = new Schema( { name: String, type: String }, { methods: { findSimilarTypes(cb) { return mongoose.model('Animal').find({ type: this.type }, cb); } } } );Using
methodsobject directly in the schema:javascript animalSchema.methods.findSimilarTypes = function(cb) { return mongoose.model('Animal').find({ type: this.type }, cb); };Using
Schema.method()helper:javascript animalSchema.method('findSimilarTypes', function(cb) { return mongoose.model('Animal').find({ type: this.type }, cb); });3. Explanation in Simple Words with Examples:
Why it's Used:
Imagine you have a collection of animals in your database, and you want to find other animals of the same type. Instead of writing the same logic repeatedly, you can define a method that can be called on each animal instance to find similar types. This helps in keeping your code DRY (Don't Repeat Yourself) and makes it easier to maintain.
Example:
```javascript const mongoose = require('mongoose'); const { Schema } = mongoose;
// Define a schema with a custom instance method const animalSchema = new Schema({ name: String, type: String });
// Add a custom instance method to find similar types animalSchema.methods.findSimilarTypes = function(cb) { return mongoose.model('Animal').find({ type: this.type }, cb); };
// Create the Animal model using the schema const Animal = mongoose.model('Animal', animalSchema);
// Create an instance of Animal const dog = new Animal({ type: 'dog', name: 'Buddy' });
// Use the custom method to find similar types dog.findSimilarTypes((err, similarAnimals) => { console.log(similarAnimals); }); ```
In this example,
findSimilarTypesis a custom instance method added to theAnimalschema. When you create an instance of theAnimalmodel (e.g., a dog), you can then callfindSimilarTypeson that instance to find other animals with the same type. The method uses thethis.typeproperty, which refers to the type of the current animal instance. This allows you to easily reuse the logic for finding similar types across different instances of theAnimalmodel.
Tags
Annotators
URL
-
- Jul 2023
-
-
- Title
- Big Oil v the World Series 1 03 Delay
- Author
- BBC
- Title
-
-
-
- Title
- Big Oil v the World Series 1 02 Doubt
- Author BBC
- Title
-
-
-
- Title
- Big Oil v the World Series 1 01 Denial
- Author BBC
- Title
-
- Oct 2018
-
primarydocuments.ca primarydocuments.ca
-
It will be observed that the basis of confederation now proposed differs from that of-the-United States in several important particulars. It does not profess to be derived from the people, but would be the Constitution provided by the Imperial Parliament; thus affording the means of remedying any defect, which is now practically impossible under the American Constitution.
§§.91, 91(1), and 92(1) of the Constitution Act, 1867.
Part V of the Constitution Act, 1982.
-
- Sep 2018
-
primarydocuments.ca primarydocuments.ca
-
It appears therefore that the only alternative which now offers itself to the inhabitants of Lower Canada is a choice between dissolution pure and simple, or Confederation on one side, and representation by population on the other. And however opposed Lower Canada may be to representation by population, is there not imminent danger that it may be finally imposed upon it, if it resist all measures of reform, the object of which is to leave to the local authorities of each section the control of its own interests and institutions. We should not forget that the same authority which imposed on us the Act of Union, or which altered it without our consent, by repealing the clause which required the concurrence of two thirds of the members of both Houses in order to change the representation respecting the two sections, may again intervene to impose upon us this new change.
Preamble, Part V, §§.51, 52, 91, 91(1), 92, and 92(2) of the Constitution Act, 1867. of the Constitution Act, 1867.
Tags
- Part V of the Constitution Act 1867
- Preamble of the Constitution Act 1867
- Section 51 of the Constitution Act 1867
- Section 91(1) of the Constitution Act 1867
- Section 92(2) of the Constitution Act 1867
- Section 92 of the Constitution Act 1867
- Section 91 of the Constitution Act 1867
- Section 52 of the Constitution Act 1867
Annotators
URL
-
-
primarydocuments.ca primarydocuments.ca
-
alluded the other day to the conservative feature of the Senate in the United States, in allowing the same representation to small states as to the larger states. But this does not at all affect the general arrangement, because the large majority are large states. But while my honorable friend approves of this portion, he should have expressed an opinion on the whole system. In the United States, no change of Constitution can be effected without the consent of two-thirds of both branches of the Legislature, and that must afterwards be sanctioned by three fourths of the state governments. This is a conservative feature also.
-