0
Q:

F# mongodb insert to array

    type FriendModel = {
        Name : string
        Phone : string
    }
    type PersonModel = {
        Name : string
        Friends: FriendModel list
    }

    let insertNewFriend (personName:string) (newFriend:FriendModel) = 
        let filter = Builders<PersonModel>.Filter.Eq((fun x -> x.Name), personName)
        let fields = StringFieldDefinition<PersonModel>("Friends")
        let updateDefinition = Builders<PersonModel>.Update.Push(fields,{Name="Mahdi";Phone="+1"})
        collections.UpdateOne(filter,updateDefinition)      
0

New to Communities?

Join the community