Comments (11)
@sojin this is because some of the documents don't have age as an attribute and rethink is strict about errors (if an attribute is missing and you try to use it, it'll throw an error). We'll make an api much nicer to deal with cases like this, but in the meantime you can try this:
db('python_tutorial').table('heroes').filter(lambda row: row.contains('age') & (r['age'] ==26)).run()
from rethinkdb.
Thanks, that did the trick.We are evaluating Rethink as an alternative for MongoDB, still trying to get my head around the docs. :)
from rethinkdb.
Great, all questions are welcome (irc, here, or google groups)!
from rethinkdb.
Ok, we need to add the following two enhacements:
# Defaults in attr access
table('foo').filter(r['bar', 0] == 1).run()
# Defaults command on streams
table('foo').defaults({ 'bar': 0 }).filter(r['bar'] == 1).run()
Moving to backlog, will address when some pressing initial issues are worked out.
from rethinkdb.
Can we have something to also have every attribute to default to nil? (I don't want to spend my time specifying the name of each attribute I'm going to use in the filter)
from rethinkdb.
I reopened #183, so we may try to find a different approach to this problem (although adding a modifier to evaluate missing attributes to nil is one option).
from rethinkdb.
I think a default command would be a good thing, though it shouldn't be used to address #183. I think there should be a ni | undefined value that behaves a lot like NaN and causes the row to be removed by default.
from rethinkdb.
The discussion if this has become a bit fractures but I think that were all
in agreement (although we haven't explicitly said it) that filter and
similar commands will be looking for Nothing
and dropping those rows.
On Feb 23, 2013 6:27 PM, "Craig" [email protected] wrote:
I think a default command would be a good thing, though it shouldn't be
used to address #183 #183.
I think there should be a ni | undefined value that behaves a lot
like NaN and causes the row to be removed by default.—
Reply to this email directly or view it on GitHubhttps://github.com//issues/27#issuecomment-14002217.
from rethinkdb.
This may or may not be a dup of #183, depending on how we look at it. I'll consider this shortly.
from rethinkdb.
FYI -- defaults
on streams could be implemented as a special kind of merge, which would require a new merge function to do right, which would require a map over objects to do right (of course we could also just do it, and fill in the architectural foundation later). Anyway, this is all discussed on google groups, and the link to the discussion is in the body of the issue #186. (Just so we don't lose track of the fact that these things are related).
from rethinkdb.
This issue has now been subsumed by #570. Closing.
from rethinkdb.
Related Issues (20)
- Rethinkdb Proxy
- Set a name to a proxy name HOT 3
- Add "Buffers" from /proc/meminfo in parse_meminfo_file to determine available memory
- download.rethinkdb.com is down, 502 Bad Gateway HOT 2
- Evaluate Profile-Guided Optimization (PGO) on RethinkDB
- error: to_string called on an uninitialized ip_address_t, addr_type: 0 compiling rethinkdb on Raspberry HOT 6
- RethinkDB not fully supported on Raspberry PI OS Bullseye (32/64 bit) HOT 10
- Reasonable to change hard-coded cluster size? HOT 5
- help bro my issue = warn: Problem when checking for new versions of RethinkDB: HTTP request to update.rethinkdb.com failed. HOT 1
- cluster connect/reconnect timeout HOT 1
- Installation fails in Kubuntu 23.10 HOT 4
- Generate web_assets.cc in a repeatable file order HOT 1
- Avoid full paths of coffeescript files in generation of web_assets.cc HOT 2
- Rethinkdb 2.4.4 release list HOT 11
- Support protobuf 25
- Return multiple changes feed
- Cache miss rate measurements HOT 4
- Something i forgot to had when having the default doc like so
- Connect rethinkdb directly from browser ? HOT 1
- Why exactly do rethinkDB add null characters to response / request JSON ? HOT 5
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 rethinkdb.