You are not logged in.
Pages: 1
Hi AB,
I'm trying to insert this:
[{_id:1,name:"test1"},{_id:2,name:"test2"},{_id:3,name:"test3"}]
using TmongoCollection.insertJSON
But I find a single line in mongodb:
{
"_id" : ObjectId("54937698dd6a6a28075ffb63"),
"0" : {
"_id" : 1,
"name" : "test1"
},
"1" : {
"_id" : 2,
"name" : "test2"
},
"2" : {
"_id" : 3,
"name" : "test3"
}
}
Why ?
Offline
sql:='select * from mysqlitedb';
r.Prepare(demo.DB,sql);
json:=demo.ExecuteJSON(sql,TRUE);
after run:
json:='[{_id:1,name:"test1"},{_id:2,name:"test2"},{_id:3,name:"test3"}]';
after I send it to a rest server:
var
pu:Putf8char;
begin
pu:=putf8char(json);
collection.InsertJSON(pu);
end;
collection is a TmongoCollection
the aim was to read a db SqlLite , and add in mongodb.
I thought the json generated is converted into an array, instead he inserirsce an array in an element.
how do I do it ?
Offline
how ?
json-->array of PUTF8Char
Offline
Pages: 1