db.events.find(
{
d : {
$gte : ISODate('2015-03-19 16:00:12.000Z'),
$lt : ISODate('2015-03-19 16:00:30.000Z')
}
}
)db.events.find(
{
d : {
$gte : {$date : '2015-03-19 16:00:12.000Z'},
$lt : {$date : '2015-03-19 16:00:30.000Z'}
}
}
) JSON.parse(
" {\n" +
" d : {\n" +
" $gte : ISODate('2015-03-19 16:00:12.000Z'), \n" +
" $lt : ISODate('2015-03-19 16:00:30.000Z')\n" +
" }\n" +
" }\n" +
")"
);
Caused by: com.mongodb.util.JSONParseException:
{
d : {
$gte : ISODate('2015-03-19 16:00:12.000Z'),
$lt : ISODate('2015-03-19 16:00:30.000Z')
}
}
)
^
at com.mongodb.util.JSONParser.parse(JSON.java:208)
at com.mongodb.util.JSONParser.parseObject(JSON.java:241)
at com.mongodb.util.JSONParser.parse(JSON.java:205)
at com.mongodb.util.JSONParser.parseObject(JSON.java:241)
at com.mongodb.util.JSONParser.parse(JSON.java:205)
at com.mongodb.util.JSONParser.parse(JSON.java:155)
at com.mongodb.util.JSON.parse(JSON.java:93)
at com.mongodb.util.JSON.parse(JSON.java:74)
db.events.find(
{
d : {
$gte : { "$date" : { "$numberLong" : "1426780800000" } },
$lt : { "$date" : { "$numberLong" : "1426780801000" } }
}
}
)
db.events.find(
{
d : {
$gte : { $date : { $numberLong : 0 } }
}
}
){
"_id" : ObjectId("5510418faa242356629cd69e"),
"uid" : "97d50fdc-8b81-41eb-82da-9d86984dbedc",
"v" : 75,
"T" : "qos",
"d" : ISODate("2015-03-19T16:00:12.000Z"),
"da" : "This is some constant data because we don't really know what is going to be in this field going forward",
"TT" : "mediasizechange"
}
To view this discussion on the web visit https://groups.google.com/d/msgid/mongodb-user/ccb13733-71e4-49a7-97be-05b8cc7bd3eb%40googlegroups.com.--
You received this message because you are subscribed to the Google Groups "mongodb-user"
group.
For other MongoDB technical support options, see: http://www.mongodb.org/about/support/.
---
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-user...@googlegroups.com.
To post to this group, send email to mongod...@googlegroups.com.
Visit this group at http://groups.google.com/group/mongodb-user.
db
.command("errmsg" -> "no such command: { aggregate: 'events', pipeline: [ { $match : { T : 'qos', TT : 'buffering' } } ]}"
Jeff,So, I am not really clear what you mean by "manually" convert.Our goal, is to have a "report definition" in a text file. Part of that definition is a query template. In the final system, the date "values" will be replaced with user entered text, so the text file will not have literal dates, but rather replacement tokens such as ... ISODate($dateFrom) (or something to this effect). So, we would read the template, replace placeholders with user entered values, and hopefully submit to Mongo from Spring's RestTemplate. This is what we are really trying to accomplish.What are the alternatives? Is the 3.0.0 mongo driver available on GitHub so we can start playing with it? Can you elaborate on what you mean by "manually" convert?Thanks.-AP_
On Wednesday, March 25, 2015 at 8:08:58 PM UTC-7, Jeff Yemin wrote:
To view this discussion on the web visit https://groups.google.com/d/msgid/mongodb-user/5fa92fc2-876c-46a7-ac21-aabf0fb95f1f%40googlegroups.com.
<dependency> <groupId>org.mongodb</groupId> <artifactId>mongo-java-driver</artifactId> <version>3.0.0-rc1</version></dependency> |
final long
countResult2 =
mongoTemplate
.getDb()
.getCollection("events")
.count(
BasicDBObjectBuilder
.start(
"d",
BasicDBObjectBuilder
.start()
.add("$gte", ISODateTimeFormat.dateTime().parseDateTime("2015-03-19T16:00:00.000Z").toDate())
.add("$lt", ISODateTimeFormat.dateTime().parseDateTime("2015-03-19T16:00:01.000Z").toDate())
.get()
)
.get()
);final long
countResult1 =
mongoTemplate
.getDb()
.getCollection("events")
.count(
(DBObject)
JSON.parse(
"{ \"d\" : { \"$gt\" : { \"$date\" : \"2015-03-19T16:00:00.000Z\" }, \"$lt\" : { \"$date\" : \"2015-03-19T16:00:01.000Z\" } } }"
)
);To view this discussion on the web visit https://groups.google.com/d/msgid/mongodb-user/84218c4d-20f3-4963-a0cd-e8bd06d0be46%40googlegroups.com.
"{" +
" aggregate: 'events'," +
" pipeline: [" +
" {" +
" $match : {" +
" d : { " +
" $gte : { $date : '2015-03-19T16:00:00.000Z' }, " +
" $lt : { $date : '2015-03-19T16:00:01.000Z' } " +
" }" +
" }" +
" }" +
" ]" +
"}"...