Comments (7)
Thanks for writing, Mariuis ( @mariusbancos ). I hope Variety is working well for you, overall.
Let's look at the example in the linked documentation section:
$ mongo test --eval "var collection = 'users', query = {'caredAbout':true}" variety.js
So, anybody correct me if I'm wrong, but query
"takes a standard Mongo[DB] query object," meaning that we more or less pass this value through to MongoDB. To that end, I suspect that referencing the relevant MongoDB documentation for whichever version you're using, would be the correct path to take.
Does that help?
from variety.
So, @JamesCropcho, in fact I'm using variety-cli (but I guess it's the same problem with variety) the problem is that if I write the following command
variety-cli {MONGODB_CONNECTION_PARAMS} --quiet --query='{"company": ObjectId("5a6b446d46246c5b6eaaa4a4")}' --outputFormat='json'
I get the following error
(node:4328) UnhandledPromiseRejectionWarning: Error: Failed to parse option 'query': End of input while parsing an object (missing '}') at line 1,49 >>>"company": ObjectId( ...
at Object.parseHson [as parser]
Maybe it's a better example this.
Let me know how to solve it.
Regards.
from variety.
Thanks for getting back to us, @mariusbancos.
Huh, this one is a bit of a stumper (not to mention that I personally don't have much Variety-CLI experience).
@todvora, do you happen to see anything funny there?
βJames
from variety.
Sorry we cannot be of assistance to you, @mariusbancos. It sounds like nobody has any idea. I'm going to leave this issue open, however, in the hopes that someday an individual sees this thread, who is able to address it.
from variety.
Hi,
Sorry for my (very delayed) response! I somehow missed that there is this issue.
I confirm that there is a problem. If I call directly Variety without variety-cli, it works:
mongo myDb --eval "var collection = 'myCollection', query={'_id':ObjectId('599676b91ad81078a0d473c9')}" variety.js
But when I try to do the same via variety-cli, it fails as you describe. The first problem is that variety-cli parses the query
expression and the ObjectId
is a reference to an unknown type in variety-cli (it doesn't use mongo directly, only helps to prepare the CLI command).
I'll check the code and see if there is anything I can do to make it work. Meanwhile you can use directly the original Variety without the variety-cli
wrapper, it should work for you.
Thanks,
Tomas
from variety.
Hello @todvora , indeed with variety-cli is working as expected. For the moment I'll use it like this. Maybe in the future you'll fix this in variety-cli also.
Thanks for your support,
Marius
from variety.
Truly happy that we can help, Marius ( @mariusbancos ).
Be in touch further if you need anything else.
βJ
from variety.
Related Issues (20)
- Can I use Variety in my research? HOT 3
- update to not rely on --eval HOT 7
- Variety establishes unsecure connections HOT 3
- Variety starts up, but everything is unresponsive. HOT 3
- namespace must not be empty HOT 8
- Can we support JSON in memory or in static file analysis without Mongodb? HOT 2
- Mongo Java driver - execute variety HOT 2
- golang execution of variety HOT 1
- ValueError: Namespace GExiv2 not available HOT 4
- How to use variety with a db with auth? HOT 6
- Using Variety on MongoDB Atlas databases HOT 5
- Possible to get a couple of the values of each property rather than just the last value? HOT 3
- Disable occurrence count [Feature request] HOT 2
- Use Variety in Java? HOT 3
- mongo vs mongosh HOT 1
- Remote databes support HOT 1
- Monitoring process time for huge collection HOT 2
- Suggestion: histogram option
- variety recognizes Decimal128 as Object
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from variety.