Skip to content

Instantly share code, notes, and snippets.

@Dineshs91
Created April 21, 2019 16:59
Show Gist options
  • Save Dineshs91/48cbb93b32b79ed53ab71a9ece834937 to your computer and use it in GitHub Desktop.
Save Dineshs91/48cbb93b32b79ed53ab71a9ece834937 to your computer and use it in GitHub Desktop.
Aggregates
dbClient := datastore.Client
database := dbClient.Database(datastore.DatabaseName)
collection := database.Collection("users")
user_count, _ := collection.FindOne(
context.Background(),
bson.D{},
)
fmt.Println("Number of users", user_count)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment