Hi,
in exploring using the MongoDB created a testapp where the _id field is created by the MongoDB as not setting this field explicit. Each record gets its unique _id, which makes it easy to handle in f.e. a jQuery DataTable. The record has 3 fields _id, Name, URL.
When using
the resulting list is empty.
Tried also with id as Object, same result.
When filter set on field Name then result is ok (record found).
See test project attached - tests running on a Raspberry Pi.
Should the auto creation of the _id field be avoided?
Any help appreciated?
in exploring using the MongoDB created a testapp where the _id field is created by the MongoDB as not setting this field explicit. Each record gets its unique _id, which makes it easy to handle in f.e. a jQuery DataTable. The record has 3 fields _id, Name, URL.
When using
B4X:
FindID("581349d6ae77cd0be3837eb5")
Sub FindID(id As String)
Dim filter As Map = CreateMap("_id":id)
Dim l As List = mongoCol.Find(filter, Null, Null)
Log($"Find Result: ${l.Size}"$)
End Sub
Tried also with id as Object, same result.
When filter set on field Name then result is ok (record found).
See test project attached - tests running on a Raspberry Pi.
Should the auto creation of the _id field be avoided?
Any help appreciated?