This is my data.js file where I have mentioned all the queries
export const userQuery = (userId) => {
const query = `*[_type == "user" && _id == '${userId}']`;
return query;
}
export const searchQuery = (searchTerm) => {
const query = `*[_type == "pin" && title match '${searchTerm}*' || category match '${searchTerm}*' || about match '${searchTerm}*']{
image{
asset -> {
url
}
},
_id
destination,
postedBy -> {
_id,
userName,
image
},
save[] {
_key,
postedBy -> {
_id,
userName,
image
},
},
}`
return query;
}
export const feedQuery = `*[_type == "pin"] | order(_createAt desc) {
image{
asset->{
url
}
},
_id,
destination,
postedBy->{
_id,
userName,
image
},
save[]{
_key,
postedBy->{
_id,
userName,
image
},
},
} `
This is where I have used these queries in my Pin.jsx file
<Link to={`user-profile/${postedBy?._id}`} className="flex gap-2 mt-2 items-center">
<img
className="w-8 h-8 rounded-full object-cover"
src={postedBy?.image}
alt="user-profile"
/>
<p className="font-semibold capitalize">{postedBy?.userName}</p>
</Link>
The complete error says this,
Unknown field found Encountered a field that is not defined in the schema.
Developer info This field is not defined in the schema, which could mean that the field definition has been removed or that someone else has added it to their own local project and have not deployed their changes yet.
I am not sure about how to go about this, Due to this my userName and profile image which I get through Google login aren't getting fetch