提交 d57cb20e 编写于 作者: S Sercan

date format changed as YYYY-MM-DD, insertMany implemented

上级 1a70c346
......@@ -80,6 +80,9 @@ Template.browseCollection.helpers({
case QUERY_TYPES.GEO_HAYSTACK_SEARCH:
return Spacebars.SafeString('This query executes a geo search using a <strong>geo haystack index</strong> on a collection');
case QUERY_TYPES.IS_CAPPED:
return Spacebars.SafeString('Returns if the collection is a capped collection');
default:
return '';
}
......
......@@ -3,7 +3,7 @@
<label class="col-lg-1 control-label">Pipeline</label>
<div class="col-lg-11">
<pre class="form-control" style="height: 150px" id='acePipeline'></pre>
<span class="help-block m-b-none">You can use <strong>string</strong> to query <strong>ISODate</strong> and <strong>ObjectID</strong>, date format is <strong>DD.MM.YYYY
<span class="help-block m-b-none">You can use <strong>string</strong> to query <strong>ISODate</strong> and <strong>ObjectID</strong>, date format is <strong>YYYY-MM-DD
HH:mm:ss</strong></span>
</div>
</div>
......
......@@ -3,7 +3,7 @@
<label class="col-lg-1 control-label">Selector</label>
<div class="col-lg-11">
<pre class="form-control" id='aceSelector'></pre>
<span class="help-block m-b-none">You can use <strong>string</strong> to query <strong>ISODate</strong> and <strong>ObjectID</strong>, date format is <strong>DD.MM.YYYY
<span class="help-block m-b-none">You can use <strong>string</strong> to query <strong>ISODate</strong> and <strong>ObjectID</strong>, date format is <strong>YYYY-MM-DD
HH:mm:ss</strong></span>
</div>
</div>
......
......@@ -3,7 +3,7 @@
<label class="col-lg-1 control-label">Index Field</label>
<div class="col-lg-11">
<pre class="form-control" id='aceFields'></pre>
<span class="help-block m-b-none">You can use <strong>string</strong> to query <strong>ISODate</strong> and <strong>ObjectID</strong>, date format is <strong>DD.MM.YYYY
<span class="help-block m-b-none">You can use <strong>string</strong> to query <strong>ISODate</strong> and <strong>ObjectID</strong>, date format is <strong>YYYY-MM-DD
HH:mm:ss</strong></span>
</div>
</div>
......
......@@ -3,7 +3,7 @@
<label class="col-lg-1 control-label">Selector</label>
<div class="col-lg-11">
<pre class="form-control" id='aceSelector'></pre>
<span class="help-block m-b-none">You can use <strong>string</strong> to query <strong>ISODate</strong> and <strong>ObjectID</strong>, date format is <strong>DD.MM.YYYY
<span class="help-block m-b-none">You can use <strong>string</strong> to query <strong>ISODate</strong> and <strong>ObjectID</strong>, date format is <strong>YYYY-MM-DD
HH:mm:ss</strong></span>
</div>
</div>
......
......@@ -3,7 +3,7 @@
<label class="col-lg-1 control-label">Selector</label>
<div class="col-lg-11">
<pre class="form-control" id='aceSelector'></pre>
<span class="help-block m-b-none">You can use <strong>string</strong> to query <strong>ISODate</strong> and <strong>ObjectID</strong>, date format is <strong>DD.MM.YYYY
<span class="help-block m-b-none">You can use <strong>string</strong> to query <strong>ISODate</strong> and <strong>ObjectID</strong>, date format is <strong>YYYY-MM-DD
HH:mm:ss</strong></span>
</div>
</div>
......
......@@ -3,7 +3,7 @@
<label class="col-lg-1 control-label">Selector</label>
<div class="col-lg-11">
<pre class="form-control" id='aceSelector'></pre>
<span class="help-block m-b-none">You can use <strong>string</strong> to query <strong>ISODate</strong> and <strong>ObjectID</strong>, date format is <strong>DD.MM.YYYY
<span class="help-block m-b-none">You can use <strong>string</strong> to query <strong>ISODate</strong> and <strong>ObjectID</strong>, date format is <strong>YYYY-MM-DD
HH:mm:ss</strong></span>
</div>
</div>
......
......@@ -3,7 +3,7 @@
<label class="col-lg-1 control-label">Selector</label>
<div class="col-lg-11">
<pre class="form-control" id='aceSelector'></pre>
<span class="help-block m-b-none">You can use <strong>string</strong> to query <strong>ISODate</strong> and <strong>ObjectID</strong>, date format is <strong>DD.MM.YYYY
<span class="help-block m-b-none">You can use <strong>string</strong> to query <strong>ISODate</strong> and <strong>ObjectID</strong>, date format is <strong>YYYY-MM-DD
HH:mm:ss</strong></span>
</div>
</div>
......
......@@ -3,7 +3,7 @@
<label class="col-lg-1 control-label">Selector</label>
<div class="col-lg-11">
<pre class="form-control" id='aceSelector'></pre>
<span class="help-block m-b-none">You can use <strong>string</strong> to query <strong>ISODate</strong> and <strong>ObjectID</strong>, date format is <strong>DD.MM.YYYY
<span class="help-block m-b-none">You can use <strong>string</strong> to query <strong>ISODate</strong> and <strong>ObjectID</strong>, date format is <strong>YYYY-MM-DD
HH:mm:ss</strong></span>
</div>
</div>
......
......@@ -3,7 +3,7 @@
<label class="col-lg-1 control-label">Selector</label>
<div class="col-lg-11">
<pre class="form-control" id='aceSelector'></pre>
<span class="help-block m-b-none">You can use <strong>string</strong> to query <strong>ISODate</strong> and <strong>ObjectID</strong>, date format is <strong>DD.MM.YYYY
<span class="help-block m-b-none">You can use <strong>string</strong> to query <strong>ISODate</strong> and <strong>ObjectID</strong>, date format is <strong>YYYY-MM-DD
HH:mm:ss</strong></span>
</div>
</div>
......@@ -12,7 +12,7 @@
<label class="col-lg-1 control-label">replacement</label>
<div class="col-lg-11">
<pre class="form-control" id='aceReplacement' style="height: 150px;"></pre>
<span class="help-block m-b-none">You can use <strong>string</strong> to query <strong>ISODate</strong> and <strong>ObjectID</strong>, date format is <strong>DD.MM.YYYY
<span class="help-block m-b-none">You can use <strong>string</strong> to query <strong>ISODate</strong> and <strong>ObjectID</strong>, date format is <strong>YYYY-MM-DD
HH:mm:ss</strong></span>
</div>
</div>
......
......@@ -3,7 +3,7 @@
<label class="col-lg-1 control-label">Selector</label>
<div class="col-lg-11">
<pre class="form-control" id='aceSelector'></pre>
<span class="help-block m-b-none">You can use <strong>string</strong> to query <strong>ISODate</strong> and <strong>ObjectID</strong>, date format is <strong>DD.MM.YYYY
<span class="help-block m-b-none">You can use <strong>string</strong> to query <strong>ISODate</strong> and <strong>ObjectID</strong>, date format is <strong>YYYY-MM-DD
HH:mm:ss</strong></span>
</div>
</div>
......@@ -12,7 +12,7 @@
<label class="col-lg-1 control-label">Set</label>
<div class="col-lg-11">
<pre class="form-control" id='aceSet'></pre>
<span class="help-block m-b-none">You can use <strong>string</strong> to query <strong>ISODate</strong> and <strong>ObjectID</strong>, date format is <strong>DD.MM.YYYY
<span class="help-block m-b-none">You can use <strong>string</strong> to query <strong>ISODate</strong> and <strong>ObjectID</strong>, date format is <strong>YYYY-MM-DD
HH:mm:ss</strong></span>
</div>
</div>
......
......@@ -3,7 +3,7 @@
<label class="col-lg-1 control-label">Docs</label>
<div class="col-lg-11">
<pre class="form-control" style="height: 150px" id='aceDocs'></pre>
<span class="help-block m-b-none">You can use <strong>string</strong> to query <strong>ISODate</strong> and <strong>ObjectID</strong>, date format is <strong>DD.MM.YYYY
<span class="help-block m-b-none">You can use <strong>string</strong> to query <strong>ISODate</strong> and <strong>ObjectID</strong>, date format is <strong>YYYY-MM-DD
HH:mm:ss</strong><br/>Furthermore, you can provide an <strong>array</strong> to insert <strong>multiple</strong> docs, or an <strong>object</strong> for <strong>single</strong> one</span>
</div>
</div>
......
/**
* Created by RSercan on 3.1.2016.
*/
Template.isCapped.executeQuery = function () {
Template.browseCollection.initExecuteQuery();
var connection = Connections.findOne({_id: Session.get(Template.strSessionConnection)});
var selectedCollection = Session.get(Template.strSessionSelectedCollection);
Meteor.call("isCapped", connection, selectedCollection, function (err, result) {
if (!result.result) {
result.result = false;
}
Template.renderAfterQueryExecution(err, result);
});
};
\ No newline at end of file
<template name="isCapped">
</template>
\ No newline at end of file
......@@ -15,7 +15,7 @@
<label class="col-lg-1 control-label">search</label>
<div class="col-lg-11">
<pre class="form-control" id='aceSearch'></pre>
<span class="help-block m-b-none">You can use <strong>string</strong> to query <strong>ISODate</strong> and <strong>ObjectID</strong>, date format is <strong>DD.MM.YYYY
<span class="help-block m-b-none">You can use <strong>string</strong> to query <strong>ISODate</strong> and <strong>ObjectID</strong>, date format is <strong>YYYY-MM-DD
HH:mm:ss</strong></span>
</div>
</div>
......
......@@ -77,7 +77,7 @@
<label class="col-lg-1 control-label">query</label>
<div class="col-lg-11">
<pre class="form-control" id='aceQuery'></pre>
<span class="help-block m-b-none">You can use <strong>string</strong> to query <strong>ISODate</strong> and <strong>ObjectID</strong>, date format is <strong>DD.MM.YYYY
<span class="help-block m-b-none">You can use <strong>string</strong> to query <strong>ISODate</strong> and <strong>ObjectID</strong>, date format is <strong>YYYY-MM-DD
HH:mm:ss</strong></span>
</div>
</div>
......
......@@ -16,7 +16,8 @@ QUERY_TYPES = {
GEO_HAYSTACK_SEARCH: "geoHaystackSearch",
GEO_NEAR: "geoNear",
INDEX_INFORMATION: "indexInformation",
INSERT_MANY: "insertMany"
INSERT_MANY: "insertMany",
IS_CAPPED : "isCapped"
};
GEO_NEAR_OPTIONS = {
......
......@@ -9,17 +9,17 @@ getConnectionUrl = function (connection) {
connectionUrl += connection.host + ':' + connection.port + '/' + connection.databaseName;
return connectionUrl;
}
};
convertBSONtoJSON = function (obj) {
convertObjectIDsToString(obj);
convertDatesToString(obj);
}
};
convertJSONtoBSON = function (obj) {
convertValidObjectIds(obj);
convertValidDates(obj);
}
};
var convertDatesToString = function (obj) {
......@@ -34,13 +34,13 @@ var convertDatesToString = function (obj) {
}
}
else {
if (obj[property] instanceof Date) {
obj[property] = moment(obj[property]).format('DD.MM.YYYY HH:mm:ss');
if (Object.prototype.toString.call(obj[property]) === '[object Date]') {
obj[property] = moment(obj[property]).format('YYYY-MM-DD HH:mm:ss.SSS');
}
}
}
}
}
};
var convertObjectIDsToString = function (obj) {
var objectID = Meteor.npmRequire('mongodb').ObjectID;
......@@ -62,7 +62,7 @@ var convertObjectIDsToString = function (obj) {
}
}
}
}
};
var convertValidObjectIds = function (obj) {
var objectID = Meteor.npmRequire('mongodb').ObjectID;
......@@ -84,7 +84,7 @@ var convertValidObjectIds = function (obj) {
}
}
}
}
};
var convertValidDates = function (obj) {
for (var property in obj) {
......@@ -98,10 +98,10 @@ var convertValidDates = function (obj) {
}
}
else {
if (moment(obj[property].toString(), 'DD.MM.YYYY HH:mm:ss', true).isValid()) {
obj[property] = moment(obj[property].toString(), 'DD.MM.YYYY HH:mm:ss', true).toDate();
if (moment(obj[property].toString(), 'YYYY-MM-DD HH:mm:ss', true).isValid()) {
obj[property] = moment(obj[property].toString(), 'YYYY-MM-DD HH:mm:ss', true).toDate();
}
}
}
}
}
\ No newline at end of file
};
\ No newline at end of file
......@@ -22,6 +22,15 @@ Meteor.methods({
});
},
'isCapped': function (connection, selectedCollection) {
var methodArray = [
{
"isCapped": []
}
];
return proceedQueryExecution(connection, selectedCollection, methodArray);
},
'insertMany': function (connection, selectedCollection, docs) {
var methodArray = [
{
......@@ -206,8 +215,9 @@ var proceedQueryExecution = function (connection, selectedCollection, methodArra
for (var i = 0; i < methodArray.length; i++) {
var last = i == (methodArray.length - 1);
var entry = methodArray[i];
for (var key in entry) {
convertJSONtoBSON(entry);
for (var key in entry) {
if (last && key == Object.keys(entry)[Object.keys(entry).length - 1]) {
entry[key].push(function (err, docs) {
done(err, docs);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册