我收集了这样的文件:
{
_id : "abcd",
name : "Tom",
myArray : [
{
field1 : "",
field2 : ""
}
]
},
{
_id : "efgh",
name : "Jerry"
}
Run Code Online (Sandbox Code Playgroud)
我有一个新的对象myArray
.我想编写一个查询来只更新一个文档.
如果查询与文档匹配_id : "abcd"
,则将新对象推入myArray
字段:
{
_id : "abcd",
name : "Tom",
myArray : [
{
field1 : "",
field2 : ""
},
{
// new object
}
]
}
Run Code Online (Sandbox Code Playgroud)
如果查询匹配,则在其中_id : "efgh"
创建myArray
包含新对象的字段:
{
_id : "efgh",
name : "Jerry"
myArray : …
Run Code Online (Sandbox Code Playgroud) I am implementing web push notification with Firebase Cloud Messaging (FCM). I have followed the documentation for setup a javascript firebase cloud messaging and completed initial implementation for my app. I am able to receive messages from firebase. But, I noticed that a database has created in IndexedDB and it named as undefined. This database contains a single store called fcm_token_object_Store, which all auth, endpoint, fcmSenderId, fcmToken, etc.
Please refer the following screenshot:
Question: Can this database_name …
我有两个单独的模板,在两个模板中(渲染)我正在做$(窗口).scroll()但是然后转到另一个模板,$(窗口).scroll()从两个,先前和当前运行模板.
代码片段如下:
dashboard1.js
Template.dashboard1.rendered = function(){
$(window).scroll(function() {
console.log('dashboard1 scroll');
//... doing pagination and sticky element for dashboard1
});
}
Template.dashboard1.destroyed = function(){
console.log('dashboard1 destroyed');
}
Run Code Online (Sandbox Code Playgroud)
dashboard2.js
Template.dashboard2.rendered = function(){
$(window).scroll(function() {
console.log('dashboard2 scroll');
//... doing pagination and sticky element for dashboard2
});
}
Template.dashboard2.destroyed = function(){
console.log('dashboard2 destroyed');
}
Run Code Online (Sandbox Code Playgroud)
安慰:
dashboard1 destroyed
dashboard2 scroll
dashboard1 scroll
dashboard2 scroll
dashboard1 scroll
dashboard2 scroll
Run Code Online (Sandbox Code Playgroud)
但是,如果我刷新浏览器,那么它只来自当前模板.
为什么会发生这种想法?解决这个问题的方法是什么?