forked from mlwmlw/pcc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdb.ls
34 lines (30 loc) · 974 Bytes
/
db.ls
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
require! <[mongodb]>
_ = require \lodash
uri = require \./database
start = new Date!
client = mongodb.MongoClient
#client = client.connect "mongodb://node:[email protected]:10024/pcc", (err, db) ->
#client = client.connect "mongodb://user:[email protected]:52827/pcc", (err, db) ->
client = client.connect uri, (err, db) ->
console.log +new Date! - +start
collection = db.collection 'pcc'
collection.aggregate { $group: { _id: { year: { $year: '$publish'}, month: { $month: '$publish'} } } }, (err, docs) ->
console.log docs
console.log +new Date! - +start
# collection.aggregate {
# $group: {
# _id: {
# year: {
# $year: '$publish'
# },
# month: {
# $month: '$publish'
# }
# }
# }
# }, (err, docs) ->
##collection.find {publish: new Date 103, 4, 30 } .toArray (err, docs) ->
#collection.find {name: /.*中油.*/ } .toArray (err, docs) ->
# docs.forEach (doc) ->
# console.log doc
# db.close!