func FindAllPost() ([]Post, error) {
	cur, err := collectionPost.Find(context.Background(), bson.D{{}})
	if err != nil {
		return nil, err
	}

	var result []Post
	for cur.Next(context.Background()) {
		elem := &bson.D{}

		err := cur.Decode(&elem)
		if err != nil {
			return nil, err
		}

		m := elem.Map()
		temp := Post{
			ID:    m["_id"].(primitive.ObjectID).Hex(),
			Title: m["title"].(string),
		}
		result = append(result, temp)
	}
	if err := cur.Err(); err != nil {
		return nil, err
	}
	cur.Close(context.Background())

	return result, nil
}
// FindAllPost find my entire posts
FindAllPost find my entire posts
// FindAllPost find my entire posts
func FindAllPost() ([]Post, error) {
	cur, err := collectionPost.Find(context.Background(), bson.D{{}})
	if err != nil {
		return nil, err
	}
	var result []Post
	for cur.Next(context.Background()) {
		elem := &bson.D{}
		err := cur.Decode(&elem)
		if err != nil {
			return nil, err
		}
		m := elem.Map()
		temp := Post{
			ID:    m["_id"].(primitive.ObjectID).Hex(),
			Title: m["title"].(string),
		}
		result = append(result, temp)
	}
	if err := cur.Err(); err != nil {
		return nil, err
	}
	cur.Close(context.Background())
	return result, nil
}
func FindAllPost ( ) ( [ ] Post , error ) { cur , err := collectionPost . Find ( context . Background ( ) , bson . D { { } } ) if err != nil { return nil , err } var result [ ] Post for cur . Next ( context . Background ( ) ) { elem := & bson . D { } err := cur . Decode ( & elem ) if err != nil { return nil , err } m := elem . Map ( ) temp := Post { ID : m [ " " ] . ( primitive . ObjectID ) . Hex ( ) , Title : m [ " " ] . ( string ) , } result = append ( result , temp ) } if err := cur . Err ( ) ; err != nil { return nil , err } cur . Close ( context . Background ( ) ) return result , nil }
FindAllPost find my entire posts
FindAllPost find my entire posts