-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make it a mongo shell plugin again #21
Comments
Made https://jira.mongodb.org/browse/INT-317 to track background work to make this happen |
@imlucas it seems that the issue no longer exists in JIRA: @rueckstiess is there any news regarding this issue? I would be interested in using this library with PyMongo and MongoDB 5. Thanks! |
Hi @Mogztter I don't think we need a mongo shell plugin for this library anymore now that the new mongo shell (mongosh) can import npm modules natively. I just tested the following to confirm:
The integration could probably be improved. I wasn't able to pass in the cursor of a find() directly into the function, instead you'll have to convert it to an array first. But I hope this will get you going in the mean time. I'm unsure about your comment regarding PyMongo. This is a Javascript library and you won't be able to use it directly from Python though. |
Oh, that's nice!
My understanding was that the MongoDB engine was able to execute JavaScript code (using from pymongo import MongoClient
client = MongoClient('localhost', 27017)
db = client.test
db.eval("""
const schema = require('mongodb-schema')
schema([{a:1, b:1}, {a: 2}, {a:3, b: 3}])
""") Similar to https://github.com/variety/variety#an-easy-example |
Oh hi! I didn’t know that this existed. One small thing to note: mongosh has an experimental feature called snippets, for even more seamlessly integrating external packages into mongosh: https://github.com/mongodb-labs/mongosh-snippets You can run
That’s true, but |
👍🏻
So
Yes but let's say we provide Out of curiosity, is there a better way than
Thanks! |
Yes, exactly 👍
Sure – I don’t think ncc is what you want, but bundlers in general could probably give you this functionality.
I’m not sure, but generally, most server-side JS execution is at least discouraged. Maybe ask yourself, why do you need this to be server-side and not client-side? |
I see, thanks for your reply 🤗 |
Should extend the DBCollection object to do
and return the serialized version of the schema found in the collection. Should thinly wrap
.find()
with all its parameters, like query, skip, limit, etcThe text was updated successfully, but these errors were encountered: