Open mozrat opened 7 years ago
Hi @mozrat and thanks for the kind words.
I think this should be possible to achieve but you need to select some other query separator (like $
) in order for this to work. Lets consider the following example.
?mongoquery=name=simon$location=London&page=2&rows=10
const qs = require('querystring');
const params = querystring.parse(req.querystring, '&');
console.log(params); // { mongoquery: "name=simon$location=London", page: 2, rows: 10 }
const queries = querystring.parse(params.mongoquery, '$');
console.log(queries); // { name: "simon", location: "London" }
Hello - great project.
My requirements are slightly different to the default behaviour of node-mongo-querystring.
Given a URL like /?mongoquery=name=simon^location=London&page=2&rows=10
I would like to access my Mongo database query just from the mongoquery URL parameter.
I considered using node-mongo-querystring and base64 encoding the query so that it could be encapsulated, but that kills URL readability. Is there a good solution you can think of?