Home > database >  Mongo roblox API wrapper issue
Mongo roblox API wrapper issue

Time:09-28

I'm using Roblox's Mongo API wrapper

https://devforum.roblox.com/t/rbx-to-mongo-a-mongodb-data-api-wrapper/1661288

However, I'm having some issues with it.

Here is my data source for mongo: My Data Source

I'm trying to get a table of all "tokens" in a table Lua code

It just returns an empty table.

CodePudding user response:

Per the additional information in the comments, it doesn't look like you have a matching document in the database.

Currently your query is looking for a document that is similar to the following:

{
    _id: 1,
    name: "tokens"
}

But the document from the screenshot resembles the following instead:

{
    _id: 6,
    tokens: [ 1, 2, 4 ]
}

You can see a demonstration of that in this Mongo Playground.

The changes that you need to make depend on what you are trying to do. If you are trying to find a document that has a specific value in the tokens array, then you may be looking for a filter similar to { tokens: 4 }. If instead you just want to retrieve a document that has a tokens field, then you may be looking for a filter such as { tokens: { $exists: true } }.

  • Related