Wednesday, 3 May 2017

Parse string to object to query from mongo db

I am trying to use a query parameter with mongo db, i sent the string as

"{"location.city":"Florida"},{"category":"sports"}"

i need to pass this as a condition, so i am trying to remove the "" with the following code.

let filter = JSON.parse(myString);

but it throws an error Unexpected token , in JSON at position 27'

Expected format:

{"location.city":"Florida"},{"category":"sports"}



via face turn

No comments:

Post a Comment