mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-03 22:37:03 +00:00
Fix $addToSet
This commit is contained in:
Vendored
+1
-1
@@ -96,7 +96,7 @@ declare module "meteor/mongo" {
|
||||
{ $each?: T[P], $position?: number, $slice?: number, $sort?: 1 | -1 | Dictionary<number> }
|
||||
}
|
||||
type ArraysOrEach<T> = {
|
||||
[P in keyof T]?: OnlyArrays<T[P]> | { $each: T[P] }
|
||||
[P in keyof T]?: OnlyElementsOfArrays<T[P]> | { $each: T[P] }
|
||||
}
|
||||
type CurrentDateModifier = { $type: "timestamp" | "date" } | true
|
||||
type Modifier<T> = T | {
|
||||
|
||||
@@ -246,7 +246,13 @@ Items.insert({ list: groceriesId, name: "Persimmons" });
|
||||
/**
|
||||
* From Collections, collection.update section
|
||||
*/
|
||||
var Players = new Mongo.Collection('Players');
|
||||
|
||||
interface Players {
|
||||
score: number
|
||||
badges: string[]
|
||||
}
|
||||
|
||||
var Players: Mongo.Collection<Players> = new Mongo.Collection('Players');
|
||||
|
||||
Template['adminDashboard'].events({
|
||||
'click .givePoints': function () {
|
||||
@@ -265,6 +271,17 @@ Meteor.methods({
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Also from Collections, collection.update section
|
||||
*/
|
||||
Meteor.methods({
|
||||
declareWinners: function () {
|
||||
Players.update({ score: { $gt: 10 } },
|
||||
{ $addToSet: { badges: {$each: ["Winner", "Super"]} } },
|
||||
{ multi: true });
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* From Collections, collection.remove section
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user