Esempio n. 1
0
    public void update(Godot.Collections.Dictionary query, Godot.Collections.Dictionary data)
    {
        var updateData = new BsonDocument(data);

        GD.Print(updateData);
        var res = _collection.UpdateOne(query.ToJson(), "{$set: " + updateData + "}");
    }
Esempio n. 2
0
    public Godot.Collections.Dictionary find_one(Godot.Collections.Dictionary query)
    {
        var res        = new Godot.Collections.Dictionary();
        var trucTrouve = _collection.Find(query.ToJson()).FirstOrDefault();

        trucTrouve["_id"] = trucTrouve["_id"].ToString();
        res = BsonSerializer.Deserialize <Godot.Collections.Dictionary>(trucTrouve);
        return(res);
    }
Esempio n. 3
0
    public Godot.Collections.Array find(Godot.Collections.Dictionary query)
    {
        var res        = new Godot.Collections.Array();
        var trucTrouve = _collection.Find(query.ToJson()).ToList();

        foreach (var unTruc in trucTrouve)
        {
            unTruc["_id"] = unTruc["_id"].ToString();
            var t = BsonSerializer.Deserialize <Godot.Collections.Dictionary>(unTruc); //par contre la, ca provoque une erreur
            res.Add(t);
        }
        return(res);
    }
Esempio n. 4
0
 public void delete(Godot.Collections.Dictionary query)
 {
     _collection.DeleteOne(query.ToJson());
 }