Comments (8)
Tried on MongoDB 4.2 and 4.4. I just validated Mongo 3.6 and it fails as you mentioned:
Error: error: {
"ok" : 0,
"errmsg" : "$not cannot have a regex",
"code" : 2,
"codeName" : "BadValue"
}
Is there a way to configure montydb in a Mongo 4 compatible way to emulate this behavior?
from montydb.
Yeah, and I think I can take a deeper look at this weekend.
I'll take the query from the first comment as test case, do add more failed cases if you could.
Pull requests are welcomed too, do let me know if you guys have any issue on fixing/improving montydb.
🍻
from montydb.
@davidlatwe I was about to work to fix this issue and I noticed that when given a regex instance the parser uses it, for example:
{ "field": {"$not": bson.Regex("(?i)Hello World") } }
Works as intended because of this:
montydb/montydb/engine/queries.py
Line 371 in bf16d65
As a side note, in MongoDB the following is valid: { "field": { "$not": { "$regex": "(?i)Hello World" } }}
from montydb.
Hey @arieltorti and @dgutson
The reason it's being blocked might be because the MongoDB version at the time I was implementing didn't allow it.
Which MongoDB version are you using?
You may have a look at the bottom of montydb/configure.py
, there's some function patching for adjusting the behavior of montydb to match against a specific mongodb version.
I was tended to make sure montydb behaves exactly the same as the targeted mongodb version to avoid any unexpected result when the production code switching back to a real mongodb. Hope that make sense. 😄
from montydb.
Yes, you need to call set_storage
before getting a client, take in-memory storage as example:
from montydb import MontyClient, set_storage
set_storage(
repository=":memory:",
storage="memory",
mongo_version="4.0", # available version: "3.6", "4.0", "4.2", "4.4"
)
client = MontyClient(":memory:")
...
from montydb.
@davidlatwe meaning: a fix has to be done in order to restore the behavior for mongodb 4.x?
from montydb.
@davidlatwe let me know if you're happy with that fix or we need to change it
from montydb.
The fix has been merged and released in 2.5.1
, closing this now.
from montydb.
Related Issues (20)
- Permission denied with empty collections on LMDB HOT 2
- Tests failed if pymongo==3.12.0 is used HOT 1
- Indexes support HOT 1
- Support for Mongoengine HOT 6
- importing MutableMapping breaks on Python 3.10 HOT 1
- Implement MongoDB aggregate
- $slice projection does not return other fields HOT 1
- Updating a document in an array leads to an error
- Multi(tasks
- Working with gridfs ? HOT 1
- MontyClient instanciation fails HOT 3
- How to install montydb with lmdb option? HOT 1
- How to use `montydb` with an existing SQLite database? HOT 2
- ConfigurationError: montydb has been config to use BSON and cannot be changed in current session. HOT 8
- Confusing behavior of set_storage vs. MontyClient with memory
- Potential race condition fix? HOT 5
- Implementing `find_one_and_update()` HOT 1
- Support for Python 3.12 HOT 4
- Feature Request: Add support for reading/writing in concurrent processes
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 montydb.