inserisce tutti i docs su mongo.

This commit is contained in:
Miki 2015-11-25 09:05:14 +01:00
parent 588244794c
commit 5656565440
2 changed files with 29 additions and 27 deletions

View file

@ -4,7 +4,7 @@ package main
import (
"fmt"
// "github.com/garyburd/redigo/redis"
"gopkg.in/mgo.v2/bson"
// "gopkg.in/mgo.v2/bson"
"log"
"strconv"
"strings"
@ -83,6 +83,7 @@ func consumer(id int) {
Date: time.Unix(date, 0),
}
// cerca se esiste gia' un documento con gli stessi User & Date
/*
docfind := []Ips{}
iter := dbs.ll.Find(bson.M{"user": prod.user, "date": time.Unix(date, 0)}).Select(bson.M{"ip": 1, "_id": 0}).Iter()
iter.All(&docfind)
@ -100,16 +101,17 @@ func consumer(id int) {
}
}
} else {
*/
// inserisce il login su Mongodb
err := dbs.ll.Insert(ml)
err = dbs.ll.Insert(ml)
if err != nil {
log.Printf("Insert error: %+v - %s\n", err, cons.user)
count.AddErr()
cons.error = true
continue
}
}
iter.Close()
// }
// iter.Close()
if opts.Debug {
log.Printf("%+v - %+v\n", ml)

View file

@ -11,7 +11,7 @@ import (
)
const (
_VERSION = "v2.3.0"
_VERSION = "v2.3.1"
)
var (