Answer the question
In order to leave comments, you need to log in
How to check if a specific document exists in PyMongo?
Is there any way to check a specific document in PyMongo? Tried like this:
@client.command(name='bio')
async def bio(ctx):
if collection.find_one(ctx.author.id)["bio"] is None:
emb = discord.Embed(title=f"Биография **{ctx.author.name}**", description="```Нету биографии```",
colour=discord.Colour.blue())
await ctx.send(embed=emb)
else:
emb = discord.Embed(title=f"Биография **{ctx.author.name}**", description=collection.find_one(ctx.author.id)["bio"],
colour=discord.Colour.blue())
await ctx.send(embed=emb)
if collection.find_one(ctx.author.id)["bio"] is None:
TypeError: 'NoneType' object is not subscriptable
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question