What Does '?' Mean When Defining Prisma Schema Model? - prisma-graphql

In this example, we see:
name String?
Not 💯 on what the ? signifies here...

This means in DB. This field can be null. It's optional.

Related

How to query text[] column in Supabase?

I want to retrieve rows based on a value being present in text column defined as multidimensional array in Supabase
Table looks like following
I am trying to query this records using following urls
https://DATABASE_URL.supabase.co/rest/v1/test_db?data=in.({"1"})
https://DATABASE_URL.supabase.co/rest/v1/test_db?data=in.(1)
But doesnt seem to work. Error message was operator does not exist: text[] ~~ unknown
with hint being No operator matches the given name and argument types. You might need to add explicit type casts.
Any help will be appreciated!
Thanks in advance.
To filter by the values inside of an array, you can use the cs operator, which is equivalent to #> (contains) in PostgreSQL.
For instance, this query will retrieve all the rows that have the value "1" present in the array of the data column.
https://DATABASE_URL.supabase.co/rest/v1/test_db?data=cs.{"1"}

How do we validate mapping document in oracle to ensure all the information has been provided?

I am new to oracle and I would like to know how do we validate mapping document in oracle to ensure all the information has been provided. The mapping document should have change logs, maintain datatypes, length, transformation rules etc. as mentioned in the requirement. Please let me know
Thanks,
Santosh
To ensure a column value must be filled, you can use 'NOT NULL' constraint.

How are polymorphic fields handled in RethinkDB?

Say I have a field A with values:
"some string"
12
["I'm an array"]
{"great": "also an object"}
How does this work? (if it does at all)
I.e: In Elasticsearch for example an implicit field mapping is created under the covers based on the first value that comes in for said field, if an explicit mapping doesn't exist.
E.g.: if "some string" comes in as first value for A, A is assumed to contain strings from then on. If afterwards anything that can't be coerced to a string is persisted, the insert will fail.
Since RethinkDb is schemaless (no field mappings), does the same logic apply here?
Or, as an alternative, nothing at all is assumed on type, and polymorphic values can live happily side by side in the same field?
nothing at all is assumed on type, same field can have different type. They can live happily side by side. When doing query, if you needs some special decision based on type of field, you can use something like branch and typeOf, or do some pre-processing with map.
You can try this in data exploerer:
r.table('user').insert({f: "12"});
r.table('user').insert({f: 12}) ;
r.table('user').insert({f: [12]});
r.table('user').insert({f: {v: 12}});

How to query a blank date in elasticsearch

Is there a way in elasticsearch to query for a date type with a blank/empty value? What value gets assigned in the index to blank date fields?
Must I use the missing filter, or is there a way to use a query - a term maybe?
Thanks.
Unless you have a null_value specified on the date field, I believe missing filter is the recommended way.
This answer in elasticsearch discussion group talks about value being null in query is treated similar to the value not present the way elasticsearch looks at it.

How to define my own primary key for a MongoDB document using Mongoid

I dont want to use _id as the primary key, but want to define my own key. How can I do it using mongoid given the following mongo object.
class Product
include Mongoid::Document
end
If you wanted to use key with another name as primary key, then you can't do that. Every document has to have a key named _id, value of which will be primary key index entry. This is how MongoDB works.
Value of _id field doesn't have to be an ObjectID, though. You can have whatever you like there (except for array, IIRC).
From the MongoDB site:
"In the MongoDB shell, ObjectId() may be used to create ObjectIds. ObjectId(string) creates an object ID from the specified hex string."
There is a code example there as well
Sergio Tulentsev got it right, _id doesn't have to be ObjectID.
However, I'm afraid that Lynn Langit's answer may be misleading. It's true that 'ObjectId(string) creates an object ID from the specified hex string', but the string here has to be a valid ObjectID. You cannot create an ObjectID from your meaningful string.

Resources