You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description / Steps to reproduce / Feature proposal
Using loopback-connector-mongodb and a hasMany relationship between two Mongo collections (PipeContainer and PipeFunction).
Inside my PipeContainerController, I can successfully do await this.pipeContainerRepository.functions(containerid).create(pipeFunctionDataObject); and it correctly creates the new PipeFunction record.
Does not remove any if the PipeFunctions linked to PipeContainer through containerid
I assume the problem is with where.
Expected Behavior
.find(); on a DefaultHasManyRepository should have returned a non empty array. .delete(); should have removed all the PipeFunction records with the given containerid.
The text was updated successfully, but these errors were encountered:
My containeridfield is a string. I am using MongoDB, so in fact it is an ObjectId(<string>)).
I assume the above issue is related to the fact that when querying:
where = {containerid: "5bdf94e84388069b10351f23"} returns []
where = {containerid: {like: "5bdf94e84388069b10351f23"}} returns all the pipefunctions with containerid == "5bdf94e84388069b10351f23"
Hi @loredanacirstea@jormar, sorry for the late reply and thank you for the detailed reproduction steps. I was able to see the issue and I think for this to work, we would need to set the strictObjectIDCoercion flag (see https://github.com/strongloop/loopback-connector-mongodb#strictobjectidcoercion-flag) on the model that is being queried, in this case, PipeFunction, so that the id is not coerced into ObjectID. To do this, you'd need to add it to the settings of the model by supplying the metadata in the model decorator for the target model as follows:
Description / Steps to reproduce / Feature proposal
Using
loopback-connector-mongodb
and ahasMany
relationship between two Mongo collections (PipeContainer
andPipeFunction
).Inside my
PipeContainerController
, I can successfully doawait this.pipeContainerRepository.functions(containerid).create(pipeFunctionDataObject);
and it correctly creates the newPipeFunction
record.However, the following do not work:
Current Behavior
returns
[]
even though there are records to be returned.I also tried
find({where: {_id: "some_valid_id"}})
and again, it returned[]
.Does not remove any if the
PipeFunctions
linked toPipeContainer
throughcontainerid
I assume the problem is with
where
.Expected Behavior
.find();
on aDefaultHasManyRepository
should have returned a non empty array..delete();
should have removed all thePipeFunction
records with the givencontainerid
.The text was updated successfully, but these errors were encountered: