Hello !
The actual Mongodb driver do not allow the update of only the fields provided but mongodb itself provides that capability.
There is plans to add this functionality to Mongodb driver ?
Cheers !
Hello !
The actual Mongodb driver do not allow the update of only the fields provided but mongodb itself provides that capability.
There is plans to add this functionality to Mongodb driver ?
Cheers !
On Mon, 20 Oct 2014 22:16:48 GMT, Domingo wrote:
Hello !
The actual Mongodb driver do not allow the update of only the fields provided but mongodb itself provides that capability.
There is plans to add this functionality to Mongodb driver ?
Cheers !
you can update individual fields as follows:
collection.update(
`{"_id": 1234}`,
`"$set": {
{"field1": 532},
{"field2": "hello"}
}`
);
Nice to know that !
The only problem with this is we should escape fileds by hand, a transparent solution would be better.
Cheers !
On Tue, 21 Oct 2014 05:28:52 GMT
"Jack Applegame" japplegame@gmail.com wrote:
On Mon, 20 Oct 2014 22:16:48 GMT, Domingo wrote:
Hello !
The actual Mongodb driver do not allow the update of only the fields provided but mongodb itself provides that capability.
There is plans to add this functionality to Mongodb driver ?
Cheers !
collection.update( `{"_id": 1234}`, `"$set": { {"field1": 532}, {"field2": "hello"} }` );
Domingo Alavarez Duarte mingodad@gmail.com
I was wrong about need to escape fields manually.
alias strrec = string[string];
strrec[string] rec;
rec["$set"] = record;
collection.update(["id":Bson(BsonObjectID.fromString(theid))], rec);
On Tue, 21 Oct 2014 08:02:21 -0700
Domingo Alavarez Duarte mingodad@gmail.com wrote:
Nice to know that !
The only problem with this is we should escape fileds by hand, a transparent solution would be better.
Cheers !
On Tue, 21 Oct 2014 05:28:52 GMT
"Jack Applegame" japplegame@gmail.com wrote:On Mon, 20 Oct 2014 22:16:48 GMT, Domingo wrote:
Hello !
The actual Mongodb driver do not allow the update of only the fields provided but mongodb itself provides that capability.
There is plans to add this functionality to Mongodb driver ?
Cheers !
collection.update( `{"_id": 1234}`, `"$set": { {"field1": 532}, {"field2": "hello"} }` );
Domingo Alavarez Duarte mingodad@gmail.com
Domingo Alavarez Duarte mingodad@gmail.com
On Tue, 21 Oct 2014 09:11:15 -0700, Domingo Alavarez Duarte wrote:
I was wrong about need to escape fields manually.
Yes. Another posibility, if values have different types (not only strings):
collection.update(
["_id": id], ["$set": [
["field1": value1.serializeToBson],
["field2": value2.serializeToBson],
["field3": value3.serializeToBson]
]]
);