Vous êtes sur la page 1sur 12

package main

import (
"fmt"
"time"

mgo "gopkg.in/mgo.v2"
"gopkg.in/mgo.v2/bson"
)

func main() {
s, _ := mgo.Dial("localhost:27017")
s.SetMode(mgo.Monotonic, true)
db := s.DB("new")

index := mgo.Index{
Key: []string{"url"},
Unique: true,
DropDups: true,
Background: true,
Sparse: true,
}

c := db.C("c2")
c.EnsureIndex(index)

// var query bson.M


now := time.Now()

for index := 1; index <= 15; index++ {


insertquery := bson.M{
"_id": bson.NewObjectId().Hex(),
"title": "sample",
"url": index,
"date_created": &now,
}
c.Insert(insertquery)

}
fmt.Println("inserted")
}

package main

import (
"fmt"
"time"

mgo "gopkg.in/mgo.v2"
"gopkg.in/mgo.v2/bson"
)

func main() {
s, _ := mgo.Dial("localhost:27017")
s.SetMode(mgo.Monotonic, true)
db := s.DB("new")

index := mgo.Index{
Key: []string{"url"},
Unique: true,
DropDups: true,
Background: true,
Sparse: true,
}

c := db.C("c2")
c.EnsureIndex(index)

// var query bson.M


now := time.Now()

for index := 1; index <= 15; index++ {


insertquery := bson.M{
"_id": bson.NewObjectId().Hex(),
"title": "sample",
"url": index,
"date_created": &now,
}
c.Insert(insertquery)

}
fmt.Println("inserted")
}

package main

import (
"fmt"
"time"

mgo "gopkg.in/mgo.v2"
"gopkg.in/mgo.v2/bson"
)

func main() {
s, _ := mgo.Dial("localhost:27017")
s.SetMode(mgo.Monotonic, true)
db := s.DB("new")

index := mgo.Index{
Key: []string{"url"},
Unique: true,
DropDups: true,
Background: true,
Sparse: true,
}

c := db.C("c2")
c.EnsureIndex(index)

// var query bson.M


now := time.Now()

for index := 1; index <= 15; index++ {


insertquery := bson.M{
"_id": bson.NewObjectId().Hex(),
"title": "sample",
"url": index,
"date_created": &now,
}
c.Insert(insertquery)

}
fmt.Println("inserted")
}

package main

import (
"fmt"
"time"

mgo "gopkg.in/mgo.v2"
"gopkg.in/mgo.v2/bson"
)

func main() {
s, _ := mgo.Dial("localhost:27017")
s.SetMode(mgo.Monotonic, true)
db := s.DB("new")

index := mgo.Index{
Key: []string{"url"},
Unique: true,
DropDups: true,
Background: true,
Sparse: true,
}

c := db.C("c2")
c.EnsureIndex(index)

// var query bson.M


now := time.Now()

for index := 1; index <= 15; index++ {


insertquery := bson.M{
"_id": bson.NewObjectId().Hex(),
"title": "sample",
"url": index,
"date_created": &now,
}
c.Insert(insertquery)

}
fmt.Println("inserted")
}

package main

import (
"fmt"
"time"

mgo "gopkg.in/mgo.v2"
"gopkg.in/mgo.v2/bson"
)
func main() {
s, _ := mgo.Dial("localhost:27017")
s.SetMode(mgo.Monotonic, true)
db := s.DB("new")

index := mgo.Index{
Key: []string{"url"},
Unique: true,
DropDups: true,
Background: true,
Sparse: true,
}

c := db.C("c2")
c.EnsureIndex(index)

// var query bson.M


now := time.Now()

for index := 1; index <= 15; index++ {


insertquery := bson.M{
"_id": bson.NewObjectId().Hex(),
"title": "sample",
"url": index,
"date_created": &now,
}
c.Insert(insertquery)

}
fmt.Println("inserted")
}

package main

import (
"fmt"
"time"

mgo "gopkg.in/mgo.v2"
"gopkg.in/mgo.v2/bson"
)

func main() {
s, _ := mgo.Dial("localhost:27017")
s.SetMode(mgo.Monotonic, true)
db := s.DB("new")

index := mgo.Index{
Key: []string{"url"},
Unique: true,
DropDups: true,
Background: true,
Sparse: true,
}

c := db.C("c2")
c.EnsureIndex(index)
// var query bson.M
now := time.Now()

for index := 1; index <= 15; index++ {


insertquery := bson.M{
"_id": bson.NewObjectId().Hex(),
"title": "sample",
"url": index,
"date_created": &now,
}
c.Insert(insertquery)

}
fmt.Println("inserted")
}

package main

import (
"fmt"
"time"

mgo "gopkg.in/mgo.v2"
"gopkg.in/mgo.v2/bson"
)

func main() {
s, _ := mgo.Dial("localhost:27017")
s.SetMode(mgo.Monotonic, true)
db := s.DB("new")

index := mgo.Index{
Key: []string{"url"},
Unique: true,
DropDups: true,
Background: true,
Sparse: true,
}

c := db.C("c2")
c.EnsureIndex(index)

// var query bson.M


now := time.Now()

for index := 1; index <= 15; index++ {


insertquery := bson.M{
"_id": bson.NewObjectId().Hex(),
"title": "sample",
"url": index,
"date_created": &now,
}
c.Insert(insertquery)

}
fmt.Println("inserted")
}

package main
import (
"fmt"
"time"

mgo "gopkg.in/mgo.v2"
"gopkg.in/mgo.v2/bson"
)

func main() {
s, _ := mgo.Dial("localhost:27017")
s.SetMode(mgo.Monotonic, true)
db := s.DB("new")

index := mgo.Index{
Key: []string{"url"},
Unique: true,
DropDups: true,
Background: true,
Sparse: true,
}

c := db.C("c2")
c.EnsureIndex(index)

// var query bson.M


now := time.Now()

for index := 1; index <= 15; index++ {


insertquery := bson.M{
"_id": bson.NewObjectId().Hex(),
"title": "sample",
"url": index,
"date_created": &now,
}
c.Insert(insertquery)

}
fmt.Println("inserted")
}

package main

import (
"fmt"
"time"

mgo "gopkg.in/mgo.v2"
"gopkg.in/mgo.v2/bson"
)

func main() {
s, _ := mgo.Dial("localhost:27017")
s.SetMode(mgo.Monotonic, true)
db := s.DB("new")

index := mgo.Index{
Key: []string{"url"},
Unique: true,
DropDups: true,
Background: true,
Sparse: true,
}

c := db.C("c2")
c.EnsureIndex(index)

// var query bson.M


now := time.Now()

for index := 1; index <= 15; index++ {


insertquery := bson.M{
"_id": bson.NewObjectId().Hex(),
"title": "sample",
"url": index,
"date_created": &now,
}
c.Insert(insertquery)

}
fmt.Println("inserted")
}

package main

import (
"fmt"
"time"

mgo "gopkg.in/mgo.v2"
"gopkg.in/mgo.v2/bson"
)

func main() {
s, _ := mgo.Dial("localhost:27017")
s.SetMode(mgo.Monotonic, true)
db := s.DB("new")

index := mgo.Index{
Key: []string{"url"},
Unique: true,
DropDups: true,
Background: true,
Sparse: true,
}

c := db.C("c2")
c.EnsureIndex(index)

// var query bson.M


now := time.Now()

for index := 1; index <= 15; index++ {


insertquery := bson.M{
"_id": bson.NewObjectId().Hex(),
"title": "sample",
"url": index,
"date_created": &now,
}
c.Insert(insertquery)

}
fmt.Println("inserted")
}

package main

import (
"fmt"
"time"

mgo "gopkg.in/mgo.v2"
"gopkg.in/mgo.v2/bson"
)

func main() {
s, _ := mgo.Dial("localhost:27017")
s.SetMode(mgo.Monotonic, true)
db := s.DB("new")

index := mgo.Index{
Key: []string{"url"},
Unique: true,
DropDups: true,
Background: true,
Sparse: true,
}

c := db.C("c2")
c.EnsureIndex(index)

// var query bson.M


now := time.Now()

for index := 1; index <= 15; index++ {


insertquery := bson.M{
"_id": bson.NewObjectId().Hex(),
"title": "sample",
"url": index,
"date_created": &now,
}
c.Insert(insertquery)

}
fmt.Println("inserted")
}

package main

import (
"fmt"
"time"

mgo "gopkg.in/mgo.v2"
"gopkg.in/mgo.v2/bson"
)
func main() {
s, _ := mgo.Dial("localhost:27017")
s.SetMode(mgo.Monotonic, true)
db := s.DB("new")

index := mgo.Index{
Key: []string{"url"},
Unique: true,
DropDups: true,
Background: true,
Sparse: true,
}

c := db.C("c2")
c.EnsureIndex(index)

// var query bson.M


now := time.Now()

for index := 1; index <= 15; index++ {


insertquery := bson.M{
"_id": bson.NewObjectId().Hex(),
"title": "sample",
"url": index,
"date_created": &now,
}
c.Insert(insertquery)

}
fmt.Println("inserted")
}

package main

import (
"fmt"
"time"

mgo "gopkg.in/mgo.v2"
"gopkg.in/mgo.v2/bson"
)

func main() {
s, _ := mgo.Dial("localhost:27017")
s.SetMode(mgo.Monotonic, true)
db := s.DB("new")

index := mgo.Index{
Key: []string{"url"},
Unique: true,
DropDups: true,
Background: true,
Sparse: true,
}

c := db.C("c2")
c.EnsureIndex(index)

// var query bson.M


now := time.Now()

for index := 1; index <= 15; index++ {


insertquery := bson.M{
"_id": bson.NewObjectId().Hex(),
"title": "sample",
"url": index,
"date_created": &now,
}
c.Insert(insertquery)

}
fmt.Println("inserted")
}

package main

import (
"fmt"
"time"

mgo "gopkg.in/mgo.v2"
"gopkg.in/mgo.v2/bson"
)

func main() {
s, _ := mgo.Dial("localhost:27017")
s.SetMode(mgo.Monotonic, true)
db := s.DB("new")

index := mgo.Index{
Key: []string{"url"},
Unique: true,
DropDups: true,
Background: true,
Sparse: true,
}

c := db.C("c2")
c.EnsureIndex(index)

// var query bson.M


now := time.Now()

for index := 1; index <= 15; index++ {


insertquery := bson.M{
"_id": bson.NewObjectId().Hex(),
"title": "sample",
"url": index,
"date_created": &now,
}
c.Insert(insertquery)

}
fmt.Println("inserted")
}

package main
import (
"fmt"
"time"

mgo "gopkg.in/mgo.v2"
"gopkg.in/mgo.v2/bson"
)

func main() {
s, _ := mgo.Dial("localhost:27017")
s.SetMode(mgo.Monotonic, true)
db := s.DB("new")

index := mgo.Index{
Key: []string{"url"},
Unique: true,
DropDups: true,
Background: true,
Sparse: true,
}

c := db.C("c2")
c.EnsureIndex(index)

// var query bson.M


now := time.Now()

for index := 1; index <= 15; index++ {


insertquery := bson.M{
"_id": bson.NewObjectId().Hex(),
"title": "sample",
"url": index,
"date_created": &now,
}
c.Insert(insertquery)

}
fmt.Println("inserted")
}

package main

import (
"fmt"
"time"

mgo "gopkg.in/mgo.v2"
"gopkg.in/mgo.v2/bson"
)

func main() {
s, _ := mgo.Dial("localhost:27017")
s.SetMode(mgo.Monotonic, true)
db := s.DB("new")

index := mgo.Index{
Key: []string{"url"},
Unique: true,
DropDups: true,
Background: true,
Sparse: true,
}

c := db.C("c2")
c.EnsureIndex(index)

// var query bson.M


now := time.Now()

for index := 1; index <= 15; index++ {


insertquery := bson.M{
"_id": bson.NewObjectId().Hex(),
"title": "sample",
"url": index,
"date_created": &now,
}
c.Insert(insertquery)

}
fmt.Println("inserted")
}

Vous aimerez peut-être aussi