This repository was archived by the owner on Aug 2, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 11
<
10BC0
/div>
This repository was archived by the owner on Aug 2, 2025. It is now read-only.
.items is not returning the items properly #15
Copy link
Copy link
Open
Description
I am trying to create something extremely simple, just a collection that has a name and that persons FCM ID. So in Node I have...
const locallydb = require('locallydb')
const db = new locallydb("./usersdb")
const collection = db.collection("users", true)
function saveToken(name, token) {
collection.insert({name: name, token: token})
}
function getUsers() {
return collection.items
}
//requests and stuff.
What is being output from the getUsers is
[
0|vctst | {
0|vctst | cid: 0,
0|vctst | '$created': '2025-03-06T21:22:02.978Z',
0|vctst | '$updated': '2025-03-06T21:22:02.978Z'
0|vctst | },
0|vctst | {
0|vctst | cid: 1,
0|vctst | '$created': '2025-03-06T21:23:16.304Z',
0|vctst | '$updated': '2025-03-06T21:23:16.304Z'
0|vctst | },
0|vctst | {
0|vctst | cid: 2,
0|vctst | '$created': '2025-03-06T21:25:28.806Z',
0|vctst | '$updated': '2025-03-06T21:25:28.806Z'
0|vctst | }
0|vctst | ]
So I tried doing something a little more creative...
function getUsers() {
let users = []
collection.items.forEach((item) => {
let user = collection.get(item.cid)
users.push(user)
})
console.log(users)
}
Same output I get an array of stuff like { cid: 0, '$created': 'datetime', '$updated': 'datetime' }, but not anything that I actually put in. I need the name and token, not the metadata for the collection.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Projects
Milestone
Relationships
Development
Issue actions
You can’t perform that action at this time.