我有一个 Mongo 数据库,其数据以这种格式存储:
{ "_id" : ObjectId("53e27f602041f3c6fe5373a8"),
"miles" : 112650,
"history" : [ { "date" : ISODate("2014-05-26T00:00:00Z"), "price" : 8995 },
{ "date" : ISODate("2014-06-01T00:00:00Z"), "price" : 8995 } ] }
Run Code Online (Sandbox Code Playgroud)
数据库中的对象可以在历史数组中存储任意数量的“日期”和“价格”数据点。但是,数据库中的某些对象将具有多个历史数据点,但最后一个“日期”键/值对不匹配带有“价格”键/值对,如下所示:
{ "_id" : ObjectId("53e27f602041f3c6fe5373a8"),
"miles" : 112650,
"history" : [ { "date" : ISODate("2014-05-26T00:00:00Z"), "price" : 8995 },
{ "date" : ISODate("2014-06-01T00:00:00Z")} ] }
Run Code Online (Sandbox Code Playgroud)
我需要查询数据库以查找 1) 历史数组中的每个条目都有日期和价格的所有对象,2) 历史数组中具有与“价格”条目不匹配的“日期”条目的所有对象。感谢您的帮助!
所以我试图使用ionic来构建一个简单的移动应用程序.我已经看过离子教程和Google搜索了很多但我还没得到它.我已经创建了一个导航栏,通过将此代码添加到index.html页面显示在每个页面上:
<body ng-app="starter">
<ion-nav-bar class="bar-stable nav-title-slide-ios7">
<ion-nav-back-button class="button-icon icon ion-ios7-arrow-back">
</ion-nav-back-button>
</ion-nav-bar>
<ion-nav-view>
</ion-nav-view>
</body>
Run Code Online (Sandbox Code Playgroud)
我使用以下代码在我的一个页面上的导航栏右侧添加了一个导航图标:
<ion-view title="Hanzi Options">
<ion-nav-buttons side="right">
<button menu-toggle="right" class="button button-icon icon ion-navicon" >
</button>
</ion-nav-buttons>
<ion-content>...etc
Run Code Online (Sandbox Code Playgroud)
我希望能够单击navicon并查看包含名为sidemenu.html的基本html页面的侧边菜单,该页面位于templates文件夹中.这是该文件中代码的开头:
<ion-side-menus>
<ion-pane ion-side-menu-content>
<ion-nav-bar class="bar-stable nav-title-slide-ios7">
<ion-nav-back-button class="button-clear"><i class="icon ion-ios7-arrow-back"></i> Back</ion-nav-back-button>
</ion-nav-bar>
<ion-nav-view name="menuContent" animation="slide-left-right"></ion-nav-view>
</ion-pane>
<ion-side-menu side="left">
<header class="bar bar-header bar-stable">
<h1 class="title">Navigate</h1>
</header>
<ion-content class="has-header">
<ion-list>
<ion-item nav-clear menu-close href="#/friends">
Friends
</ion-item>...etc
Run Code Online (Sandbox Code Playgroud)
我将此代码添加到.config部分中的app.js文件中:
.state('app.sidemenu', {
url: "/sidemenu",
abstract: true,
templateUrl: "templates/sidemenu.html",
controller: 'NavCtrl'
})
Run Code Online (Sandbox Code Playgroud)
和一个空的NavCtrl到我的controllers.js文件:
.controller('NavCtrl', …Run Code Online (Sandbox Code Playgroud)